private float getWidthForCID(int cid) { Float width = widths.get(cid); if (width == null) { width = getDefaultWidth(); } return width; }
@Override // todo: this method is highly suspicious, the average glyph width is not usually a good metric public float getAverageFontWidth() { if (Float.compare(averageWidth, 0) == 0) { float totalWidths = 0.0f; int characterCount = 0; if (widths != null) { for (Float width : widths.values()) { if (width > 0) { totalWidths += width; ++characterCount; } } } averageWidth = totalWidths / characterCount; if (averageWidth <= 0 || Float.isNaN(averageWidth)) { averageWidth = getDefaultWidth(); } } return averageWidth; }
private float getWidthForCID(int cid) { Float width = widths.get(cid); if (width == null) { width = getDefaultWidth(); } return width; }
private float getWidthForCID(int cid) { Float width = widths.get(cid); if (width == null) { width = getDefaultWidth(); } return width; }
@Override // todo: this method is highly suspicious, the average glyph width is not usually a good metric public float getAverageFontWidth() { if (averageWidth == 0) { float totalWidths = 0.0f; int characterCount = 0; if (widths != null) { for (Float width : widths.values()) { if (width > 0) { totalWidths += width; ++characterCount; } } } averageWidth = totalWidths / characterCount; if (averageWidth <= 0 || Float.isNaN(averageWidth)) { averageWidth = getDefaultWidth(); } } return averageWidth; }
@Override // todo: this method is highly suspicious, the average glyph width is not usually a good metric public float getAverageFontWidth() { if (averageWidth == 0) { float totalWidths = 0.0f; int characterCount = 0; if (widths != null) { for (Float width : widths.values()) { if (width > 0) { totalWidths += width; ++characterCount; } } } averageWidth = totalWidths / characterCount; if (averageWidth <= 0 || Float.isNaN(averageWidth)) { averageWidth = getDefaultWidth(); } } return averageWidth; }