From dacf58ac2018e017e1477aba9f1b52f227c62081 Mon Sep 17 00:00:00 2001 From: Snowyfox Date: Sun, 1 May 2022 02:46:10 -0400 Subject: [PATCH] Some font size changes. The UI needs to be easier on the eyes, I'm working on it --- ClipboardApi.java | 0 ComposeWindow.java | 11 +++++++- ImageApi.java | 0 JKomasto.java | 0 LoginWindow.java | 0 PostWindow.java | 46 +++++++++++++++++++++++----------- RepliesWindow.java | 0 RichTextPane.java | 5 ++-- TimelineWindow.java | 0 TimelineWindowUpdater.java | 0 TwoToggleButton.java | 0 graphics/Flags.xcf | Bin graphics/Hourglass.xcf | Bin graphics/button.png | Bin graphics/disabledOverlay.png | Bin graphics/favouriteToggled.png | Bin graphics/miscToggled.png | Bin graphics/miscUntoggled.png | Bin graphics/ref1.png | Bin graphics/selectedOverlay.png | Bin graphics/test1.png | Bin graphics/test2.png | Bin graphics/test3.png | Bin graphics/test4.png | Bin 24 files changed, 44 insertions(+), 18 deletions(-) mode change 100755 => 100644 ClipboardApi.java mode change 100755 => 100644 ComposeWindow.java mode change 100755 => 100644 ImageApi.java mode change 100755 => 100644 JKomasto.java mode change 100755 => 100644 LoginWindow.java mode change 100755 => 100644 PostWindow.java mode change 100755 => 100644 RepliesWindow.java mode change 100755 => 100644 TimelineWindow.java mode change 100755 => 100644 TimelineWindowUpdater.java mode change 100755 => 100644 TwoToggleButton.java mode change 100755 => 100644 graphics/Flags.xcf mode change 100755 => 100644 graphics/Hourglass.xcf mode change 100755 => 100644 graphics/button.png mode change 100755 => 100644 graphics/disabledOverlay.png mode change 100755 => 100644 graphics/favouriteToggled.png mode change 100755 => 100644 graphics/miscToggled.png mode change 100755 => 100644 graphics/miscUntoggled.png mode change 100755 => 100644 graphics/ref1.png mode change 100755 => 100644 graphics/selectedOverlay.png mode change 100755 => 100644 graphics/test1.png mode change 100755 => 100644 graphics/test2.png mode change 100755 => 100644 graphics/test3.png mode change 100755 => 100644 graphics/test4.png diff --git a/ClipboardApi.java b/ClipboardApi.java old mode 100755 new mode 100644 diff --git a/ComposeWindow.java b/ComposeWindow.java old mode 100755 new mode 100644 index 3a2dd7a..cb24259 --- a/ComposeWindow.java +++ b/ComposeWindow.java @@ -9,12 +9,14 @@ import javax.swing.JButton; import javax.swing.Box; import javax.swing.BorderFactory; import javax.swing.JOptionPane; +import javax.swing.border.Border; import java.awt.GridLayout; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.Cursor; +import java.awt.Color; import cafe.biskuteri.hinoki.Tree; import java.io.IOException; @@ -298,6 +300,11 @@ implements ActionListener { { this.primaire = primaire; + Border b1 = BorderFactory.createEmptyBorder(8, 8, 8, 8); + Border b2 = BorderFactory.createEmptyBorder(4, 4, 4, 4); + Border b3 = BorderFactory.createLineBorder(Color.GRAY); + Border bc = BorderFactory.createCompoundBorder(b3, b2); + reply = new JTextField(); JLabel replyLabel = new JLabel("In reply to: "); replyLabel.setLabelFor(reply); @@ -335,13 +342,15 @@ implements ActionListener { text = new JTextArea(); text.setLineWrap(true); text.setWrapStyleWord(true); + text.setFont(text.getFont().deriveFont(16f)); + text.setBorder(bc); setLayout(new BorderLayout(0, 8)); add(top, BorderLayout.NORTH); add(text, BorderLayout.CENTER); add(bottom, BorderLayout.SOUTH); - setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8)); + setBorder(b1); } } diff --git a/ImageApi.java b/ImageApi.java old mode 100755 new mode 100644 diff --git a/JKomasto.java b/JKomasto.java old mode 100755 new mode 100644 diff --git a/LoginWindow.java b/LoginWindow.java old mode 100755 new mode 100644 diff --git a/PostWindow.java b/PostWindow.java old mode 100755 new mode 100644 index af19740..ef48ee1 --- a/PostWindow.java +++ b/PostWindow.java @@ -687,27 +687,43 @@ implements ActionListener { { g.clearRect(0, 0, getWidth(), getHeight()); - ((java.awt.Graphics2D)g).setRenderingHint( - java.awt.RenderingHints.KEY_ANTIALIASING, - java.awt.RenderingHints.VALUE_ANTIALIAS_ON - ); - int w1 = authorName.getWidth(); int w2 = body.getWidth(); FontMetrics fm1 = getFontMetrics(authorName.getFont()); FontMetrics fm2 = getFontMetrics(body.getFont()); - authorName.setText(RichTextPane.layout(authorNameOr, fm1, w1)); - body.setText(RichTextPane.layout(bodyOr, fm2, w2)); + List lay1, lay2; + lay1 = RichTextPane.layout(authorNameOr, fm1, w1); + lay2 = RichTextPane.layout(bodyOr, fm2, w2); - List lay; - lay = RichTextPane.layout(bodyOr, fm2, w2); - int height = 0; for (RichTextPane.Segment s: lay) + authorName.setText(lay1); + body.setText(lay2); + + int maxY = 0; for (RichTextPane.Segment s: lay2) { - if ((s.y + 10) > height) height = s.y + 10; + if (s.y > maxY) maxY = s.y; } - body.setPreferredSize(new Dimension(1, height)); + body.setPreferredSize(new Dimension(1, maxY + 10)); + + ((java.awt.Graphics2D)g).setRenderingHint( + java.awt.RenderingHints.KEY_ANTIALIASING, + java.awt.RenderingHints.VALUE_ANTIALIAS_ON + ); + /* + * I suspect the reason why we are losing antialiasing, + * is that the JScrollPane asks us to paint once and + * then on scroll, it repaints from its capture of the + * viewport contents, rather than ask us to repaint. + * Then it wouldn't set the hint. + * + * We're scheduled to remove the scrolling functionality + * in favour of pages, so, we don't need to intercept + * the scroller for now. Though I feel like it would've + * made more sense to allow setting a widget's rendering + * hints. + */ } + // ---%-@-%--- PostComponent(PostWindow primaire) @@ -717,9 +733,9 @@ implements ActionListener { emojiUrls = new String[0][]; Border b = BorderFactory.createEmptyBorder(10, 10, 10, 10); - Font f1 = new Font("IPAGothic", Font.PLAIN, 16); - Font f2 = new Font("IPAGothic", Font.PLAIN, 13); - Font f3 = getFont().deriveFont(14f); + Font f1 = new Font("Dialog", Font.PLAIN, 18); + Font f2 = new Font("IPAGothic", Font.PLAIN, 14); + Font f3 = new Font("Dialog", Font.PLAIN, 20); profile = new RoundButton(); favouriteBoost = new TwoToggleButton("favourite", "boost"); diff --git a/RepliesWindow.java b/RepliesWindow.java old mode 100755 new mode 100644 diff --git a/RichTextPane.java b/RichTextPane.java index 310c8b6..b15086c 100644 --- a/RichTextPane.java +++ b/RichTextPane.java @@ -125,7 +125,8 @@ implements MouseListener, MouseMotionListener, KeyListener { identify(int x, int y) { FontMetrics fm = getFontMetrics(getFont()); - int iy = fm.getAscent(), lh = fm.getHeight(); + int iy = fm.getAscent(); + int lh = fm.getAscent() + fm.getDescent(); y -= fm.getDescent(); if (y <= iy) y = iy; else y += lh - ((y - iy) % lh); @@ -186,7 +187,7 @@ implements MouseListener, MouseMotionListener, KeyListener { text = copy; ListIterator cursor = text.listIterator(); int x = 0, y = fm.getAscent(); - int dy = fm.getHeight(); + int dy = fm.getAscent() + fm.getDescent(); while (cursor.hasNext()) { Segment curr = cursor.next(); diff --git a/TimelineWindow.java b/TimelineWindow.java old mode 100755 new mode 100644 diff --git a/TimelineWindowUpdater.java b/TimelineWindowUpdater.java old mode 100755 new mode 100644 diff --git a/TwoToggleButton.java b/TwoToggleButton.java old mode 100755 new mode 100644 diff --git a/graphics/Flags.xcf b/graphics/Flags.xcf old mode 100755 new mode 100644 diff --git a/graphics/Hourglass.xcf b/graphics/Hourglass.xcf old mode 100755 new mode 100644 diff --git a/graphics/button.png b/graphics/button.png old mode 100755 new mode 100644 diff --git a/graphics/disabledOverlay.png b/graphics/disabledOverlay.png old mode 100755 new mode 100644 diff --git a/graphics/favouriteToggled.png b/graphics/favouriteToggled.png old mode 100755 new mode 100644 diff --git a/graphics/miscToggled.png b/graphics/miscToggled.png old mode 100755 new mode 100644 diff --git a/graphics/miscUntoggled.png b/graphics/miscUntoggled.png old mode 100755 new mode 100644 diff --git a/graphics/ref1.png b/graphics/ref1.png old mode 100755 new mode 100644 diff --git a/graphics/selectedOverlay.png b/graphics/selectedOverlay.png old mode 100755 new mode 100644 diff --git a/graphics/test1.png b/graphics/test1.png old mode 100755 new mode 100644 diff --git a/graphics/test2.png b/graphics/test2.png old mode 100755 new mode 100644 diff --git a/graphics/test3.png b/graphics/test3.png old mode 100755 new mode 100644 diff --git a/graphics/test4.png b/graphics/test4.png old mode 100755 new mode 100644