Package com.openhtmltopdf.render
Class LineMetricsAdapter
java.lang.Object
com.openhtmltopdf.render.LineMetricsAdapter
- All Implemented Interfaces:
FSFontMetrics
public class LineMetricsAdapter extends Object implements FSFontMetrics
A note on this class: What we really want is a FontMetrics2D object (i.e.
font metrics with float precision). Unfortunately, it doesn't seem
the JDK provides this. However, looking at the JDK code, it appears the
metrics contained in the LineMetrics are actually the metrics of the font, not
the metrics of the line (and empirically strings of "X" and "j" return the same
value for getAscent()). So... for now we use LineMetrics for font metrics.
-
Constructor Summary
Constructors Constructor Description LineMetricsAdapter(List<Font> fonts, String str, FontRenderContext ctx) -
Method Summary
Modifier and Type Method Description floatgetAscent()floatgetDescent()In keeping with the JDKLineMetricsconvention, this number is positive for values below the baseline.floatgetStrikethroughOffset()floatgetStrikethroughThickness()floatgetUnderlineOffset()In keeping with the JDKLineMetricsconvention, this number is positive for values below the baseline.floatgetUnderlineThickness()
-
Constructor Details
-
Method Details
-
getAscent
public float getAscent()- Specified by:
getAscentin interfaceFSFontMetrics
-
getDescent
public float getDescent()Description copied from interface:FSFontMetricsIn keeping with the JDKLineMetricsconvention, this number is positive for values below the baseline.- Specified by:
getDescentin interfaceFSFontMetrics
-
getStrikethroughOffset
public float getStrikethroughOffset()- Specified by:
getStrikethroughOffsetin interfaceFSFontMetrics
-
getStrikethroughThickness
public float getStrikethroughThickness()- Specified by:
getStrikethroughThicknessin interfaceFSFontMetrics
-
getUnderlineOffset
public float getUnderlineOffset()Description copied from interface:FSFontMetricsIn keeping with the JDKLineMetricsconvention, this number is positive for values below the baseline.- Specified by:
getUnderlineOffsetin interfaceFSFontMetrics
-
getUnderlineThickness
public float getUnderlineThickness()- Specified by:
getUnderlineThicknessin interfaceFSFontMetrics
-