Examples of HorizontalMetricsTable


Examples of com.google.typography.font.sfntly.table.core.HorizontalMetricsTable

  public Glyph getGlyph(char ch) {
    int glyphIndex = lookupGlyphIndex(ch);
    com.google.typography.font.sfntly.table.truetype.Glyph glyph = getGlyph(glyphIndex);

   
      HorizontalMetricsTable hmtx = font.getTable(Tag.hmtx);
     
      double width = toPixels(glyph.xMax() - glyph.xMin());
      double height = toPixels(glyph.yMax() - glyph.yMin());
      double advance = toPixels(hmtx.advanceWidth(glyphIndex));
     
      SfntlyGlyph sfntlyGlyph = new SfntlyGlyph(advance, width, height, glyph);
      sfntlyGlyph.setScale(size / unitsPerEm);
      sfntlyGlyph.setYBounds(yMin, yMax);
      sfntlyGlyph.setFontSize(size);
View Full Code Here

Examples of org.apache.fontbox.ttf.HorizontalMetricsTable

        Map<Integer, String> codeToName = this.getFontEncoding().getCodeToNameMap();

        int firstChar = Collections.min(codeToName.keySet());
        int lastChar = Collections.max(codeToName.keySet());

        HorizontalMetricsTable hMet = ttf.getHorizontalMetrics();
        int[] widthValues = hMet.getAdvanceWidth();
        // some monospaced fonts provide only one value for the width
        // instead of an array containing the same value for every glyphid
        boolean isMonospaced = fd.isFixedPitch() || widthValues.length == 1;
        int nWidths = lastChar - firstChar + 1;
        List<Integer> widths = new ArrayList<Integer>(nWidths);
View Full Code Here

Examples of org.apache.fontbox.ttf.HorizontalMetricsTable

            Map<Integer, String> codeToName = this.getFontEncoding().getCodeToNameMap();
            
            int firstChar = Collections.min(codeToName.keySet());
            int lastChar = Collections.max(codeToName.keySet());
           
            HorizontalMetricsTable hMet = ttf.getHorizontalMetrics();
            int[] widthValues = hMet.getAdvanceWidth();
            // some monospaced fonts provide only one value for the width
            // instead of an array containing the same value for every glyphid
            boolean isMonospaced = fd.isFixedPitch();
            int nWidths=lastChar-firstChar+1;
            List<Float> widths = new ArrayList<Float>(nWidths);
View Full Code Here

Examples of org.apache.fontbox.ttf.HorizontalMetricsTable

            Map<Integer, String> codeToName = this.getFontEncoding().getCodeToNameMap();
            
            int firstChar = Collections.min(codeToName.keySet());
            int lastChar = Collections.max(codeToName.keySet());
           
            HorizontalMetricsTable hMet = ttf.getHorizontalMetrics();
            int[] widthValues = hMet.getAdvanceWidth();
            // some monospaced fonts provide only one value for the width
            // instead of an array containing the same value for every glyphid
            boolean isMonospaced = fd.isFixedPitch();
            int nWidths=lastChar-firstChar+1;
            List<Float> widths = new ArrayList<Float>(nWidths);
View Full Code Here

Examples of org.apache.fontbox.ttf.HorizontalMetricsTable

                    glyphToCCode = cmaps[i].getGlyphIdToCharacterCode();
                }
            }
            int firstChar = 0;
            int maxWidths = glyphToCCode.length;
            HorizontalMetricsTable hMet = ttf.getHorizontalMetrics();
            int[] widthValues = hMet.getAdvanceWidth();
            List widths = new ArrayList(maxWidths);
            Integer zero = new Integer( 250 );
            for( int i=0; i<maxWidths; i++ )
            {
                widths.add( zero );
View Full Code Here

Examples of org.apache.fontbox.ttf.HorizontalMetricsTable

            Map<Integer, String> codeToName = this.getFontEncoding().getCodeToNameMap();
            
            int firstChar = Collections.min(codeToName.keySet());
            int lastChar = Collections.max(codeToName.keySet());
           
            HorizontalMetricsTable hMet = ttf.getHorizontalMetrics();
            int[] widthValues = hMet.getAdvanceWidth();
            int nWidths=lastChar-firstChar+1;
            List<Float> widths = new ArrayList<Float>(nWidths);
            // width of the .notdef character.
            Float zero = Float.valueOf(widthValues[0]*scaling);
            for( int i=0; i<nWidths; i++ )
View Full Code Here

Examples of org.apache.fontbox.ttf.HorizontalMetricsTable

                    glyphToCCode = cmaps[i].getGlyphIdToCharacterCode();
                }
            }
            int firstChar = 0;
            int maxWidths = glyphToCCode.length;
            HorizontalMetricsTable hMet = ttf.getHorizontalMetrics();
            int[] widthValues = hMet.getAdvanceWidth();
            List<Float> widths = new ArrayList<Float>(maxWidths);
            float zero = 250;
            for( int i=0; i<maxWidths; i++ )
            {
                widths.add( zero );
View Full Code Here

Examples of org.apache.fontbox.ttf.HorizontalMetricsTable

            Map<Integer, String> codeToName = this.getFontEncoding().getCodeToNameMap();
            
            int firstChar = Collections.min(codeToName.keySet());
            int lastChar = Collections.max(codeToName.keySet());
           
            HorizontalMetricsTable hMet = ttf.getHorizontalMetrics();
            int[] widthValues = hMet.getAdvanceWidth();
            int nWidths=lastChar-firstChar+1;
            List<Float> widths = new ArrayList<Float>(nWidths);
            // width of the .notdef character.
            Float zero = Float.valueOf(widthValues[0]*scaling);
            for( int i=0; i<nWidths; i++ )
View Full Code Here

Examples of org.apache.fontbox.ttf.HorizontalMetricsTable

                    }
                }
            }
            int firstChar = os2.getFirstCharIndex();
            int maxWidths = glyphToCCode.length;
            HorizontalMetricsTable hMet = ttf.getHorizontalMetrics();
            int[] widthValues = hMet.getAdvanceWidth();
            List<Float> widths = new ArrayList<Float>(maxWidths);
            float zero = 250;
            for( int i=0; i<maxWidths; i++ )
            {
                widths.add( zero );
View Full Code Here

Examples of org.apache.fontbox.ttf.HorizontalMetricsTable

            Map<Integer, String> codeToName = this.getFontEncoding().getCodeToNameMap();
            
            int firstChar = Collections.min(codeToName.keySet());
            int lastChar = Collections.max(codeToName.keySet());
           
            HorizontalMetricsTable hMet = ttf.getHorizontalMetrics();
            int[] widthValues = hMet.getAdvanceWidth();
            // some monospaced fonts provide only one value for the width
            // instead of an array containing the same value for every glyphid
            boolean isMonospaced = fd.isFixedPitch();
            int nWidths=lastChar-firstChar+1;
            List<Float> widths = new ArrayList<Float>(nWidths);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.