Changeset 1198


Ignore:
Timestamp:
11/28/18 15:42:02 (6 years ago)
Author:
bln4
Message:

org.expeditee.gio.GraphicsManager ->
org.expeditee.gio.javafx.JavaFXGraphicsManager ->
org.expeditee.gio.swing.SwingGraphicsManager ->

Graphics managers can be now consulted to obtain the height of a character in a given font.

Location:
trunk/src/org/expeditee/gio
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gio/GraphicsManager.java

    r1162 r1198  
    322322                return _widgets.remove(iw);
    323323        }
     324
     325        /**
     326         * Acquire the height of text produced using this font.
     327         * @param font
     328         * @return
     329         */
     330        public abstract int getFontHeight(final Font font);
    324331}
  • trunk/src/org/expeditee/gio/javafx/JavaFXGraphicsManager.java

    r1144 r1198  
    676676        }
    677677
     678        @Override
     679        public int getFontHeight(final Font font) {
     680                final javafx.scene.text.Font fxFont = JavaFXFontManager.getInstance().getInternalFont(font);
     681                return (int) fxFont.getSize();
     682        }
     683
    678684}
  • trunk/src/org/expeditee/gio/swing/SwingGraphicsManager.java

    r1168 r1198  
    673673                }
    674674        }
     675
     676        @Override
     677        public int getFontHeight(final Font font) {
     678                final java.awt.Font awtFont = SwingFontManager.getInstance().getInternalFont(font);
     679                final FontMetrics fontMetrics = _jFrame.getGraphics().getFontMetrics(awtFont);
     680                return fontMetrics.getHeight();
     681        }
    675682}
Note: See TracChangeset for help on using the changeset viewer.