/** * Returns the height for the given GID. * * @param gid the GID * @return the height * @throws IOException if there was an error reading the metrics table. */ public int getAdvanceHeight(int gid) throws IOException { VerticalMetricsTable vmtx = getVerticalMetrics(); if (vmtx != null) { return vmtx.getAdvanceHeight(gid); } else { // this should never happen return 250; } }
/** * Build vertical metrics with Identity CIDToGIDMap (for embedding full font). */ private void buildVerticalMetrics(COSDictionary cidFont) throws IOException { if (!buildVerticalHeader(cidFont)) { return; } int cidMax = ttf.getNumberOfGlyphs(); int[] gidMetrics = new int[cidMax * 4]; for (int cid = 0; cid < cidMax; cid++) { GlyphData glyph = ttf.getGlyph().getGlyph(cid); if (glyph == null) { gidMetrics[cid * 4] = Integer.MIN_VALUE; } else { gidMetrics[cid * 4] = cid; gidMetrics[cid * 4 + 1] = ttf.getVerticalMetrics().getAdvanceHeight(cid); gidMetrics[cid * 4 + 2] = ttf.getHorizontalMetrics().getAdvanceWidth(cid); gidMetrics[cid * 4 + 3] = glyph.getYMaximum() + ttf.getVerticalMetrics().getTopSideBearing(cid); } } cidFont.setItem(COSName.W2, getVerticalMetrics(gidMetrics)); }
VerticalMetricsTable vmtx = ttf.getVerticalMetrics(); GlyphTable glyf = ttf.getGlyph(); HorizontalMetricsTable hmtx = ttf.getHorizontalMetrics();
/** * Returns the height for the given GID. * * @param gid the GID * @return the height * @throws IOException if there was an error reading the metrics table. */ public int getAdvanceHeight(int gid) throws IOException { VerticalMetricsTable vmtx = getVerticalMetrics(); if (vmtx != null) { return vmtx.getAdvanceHeight(gid); } else { // this should never happen return 250; } }
/** * Returns the height for the given GID. * * @param gid the GID * @return the height * @throws IOException if there was an error reading the metrics table. */ public int getAdvanceHeight(int gid) throws IOException { VerticalMetricsTable vmtx = getVerticalMetrics(); if (vmtx != null) { return vmtx.getAdvanceHeight(gid); } else { // this should never happen return 250; } }
/** * Build vertical metrics with Identity CIDToGIDMap (for embedding full font). */ private void buildVerticalMetrics(COSDictionary cidFont) throws IOException { if (!buildVerticalHeader(cidFont)) { return; } int cidMax = ttf.getNumberOfGlyphs(); int[] gidMetrics = new int[cidMax * 4]; for (int cid = 0; cid < cidMax; cid++) { GlyphData glyph = ttf.getGlyph().getGlyph(cid); if (glyph == null) { gidMetrics[cid * 4] = Integer.MIN_VALUE; } else { gidMetrics[cid * 4] = cid; gidMetrics[cid * 4 + 1] = ttf.getVerticalMetrics().getAdvanceHeight(cid); gidMetrics[cid * 4 + 2] = ttf.getHorizontalMetrics().getAdvanceWidth(cid); gidMetrics[cid * 4 + 3] = glyph.getYMaximum() + ttf.getVerticalMetrics().getTopSideBearing(cid); } } cidFont.setItem(COSName.W2, getVerticalMetrics(gidMetrics)); }
VerticalMetricsTable vmtx = ttf.getVerticalMetrics(); GlyphTable glyf = ttf.getGlyph(); HorizontalMetricsTable hmtx = ttf.getHorizontalMetrics();