Class StringBounderEmbeddedFont
java.lang.Object
net.sourceforge.plantuml.klimt.drawing.font.StringBounderEmbeddedFont
- All Implemented Interfaces:
StringBounder
Measures text with the metrics of the fonts embedded in PlantUML (Liberation
Sans), without AWT, so that the TeaVM C build lays out exactly as the JVM does
on Windows, and draws with the very same fonts.
It reproduces what StringBounderAwt gives on Windows, where Java maps
its logical font "SansSerif" to Arial (whose metrics are Liberation Sans's):
- a character is as wide as its glyph's advance (fractional metrics: no rounding, no kerning, no ligatures);
- a logical font is a composite: its line also makes room for the fonts it
falls back on for other scripts, which raise its ascent and descent to at
least
LOGICAL_MIN_ASCENTandLOGICAL_MIN_DESCENT; and the characters it does not take from Arial (those Arial lacks, and those of Arial's exclusion ranges in Java's fontconfig.properties, such as dashes and typographic quotes) have the widths Java gives them on Windows, measured once by tools/font-metrics/MeasureLogicalFonts.java; - a font named Arial (or Liberation Sans) is a physical font: its own line height, and its missing glyph for the characters it lacks.
Known difference: when a text contains a character of a complex script (combining marks U+0300-036F, Hebrew, Arabic, Indic, Thai, bidi controls...), Java2D shapes the whole text with HarfBuzz, which can move a mark's base or hide a soft hyphen. Other text (precomposed accents, Greek, Cyrillic...) measures exactly as with Java2D.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncalculateDimension(UFont font, String text) doublegetDescent(UFont font, String text) static StringBounderEmbeddedFontwithoutWindowsWidths(FileFormat fileFormat) A bounder without the widths measured with Java on Windows, for tools/font-metrics/MeasureLogicalFonts.java only: for the characters that do not come from Arial, logical fonts use PlantUML's width table.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.sourceforge.plantuml.klimt.font.StringBounder
matchesProperty
-
Constructor Details
-
StringBounderEmbeddedFont
-
-
Method Details
-
withoutWindowsWidths
A bounder without the widths measured with Java on Windows, for tools/font-metrics/MeasureLogicalFonts.java only: for the characters that do not come from Arial, logical fonts use PlantUML's width table. -
getFileFormat
- Specified by:
getFileFormatin interfaceStringBounder
-
calculateDimension
- Specified by:
calculateDimensionin interfaceStringBounder
-
getDescent
- Specified by:
getDescentin interfaceStringBounder
-