src/share/classes/sun/print/PathGraphics.java

Print this page




1008         int numGlyphs = font2D.getNumGlyphs();
1009         int missingGlyph = font2D.getMissingGlyphCode();
1010         char[] glyphToCharMap = new char[numGlyphs];
1011         int glyph;
1012 
1013         for (int i=0;i<numGlyphs; i++) {
1014             glyphToCharMap[i] = CharToGlyphMapper.INVISIBLE_GLYPH_ID;
1015         }
1016 
1017         /* Consider refining the ranges to try to map by asking the font
1018          * what ranges it supports.
1019          * Since a glyph may be mapped by multiple code points, and this
1020          * code can't handle that, we always prefer the earlier code point.
1021          */
1022         for (char c=0; c<0xFFFF; c++) {
1023            if (c >= CharToGlyphMapper.HI_SURROGATE_START &&
1024                c <= CharToGlyphMapper.LO_SURROGATE_END) {
1025                 continue;
1026             }
1027             glyph = font2D.charToGlyph(c);
1028             if (glyph != missingGlyph && glyph < numGlyphs &&

1029                 (glyphToCharMap[glyph] ==
1030                  CharToGlyphMapper.INVISIBLE_GLYPH_ID)) {
1031                 glyphToCharMap[glyph] = c;
1032             }
1033         }
1034         return glyphToCharMap;
1035     }
1036 
1037     /**
1038      * Strokes the outline of a Shape using the settings of the current
1039      * graphics state.  The rendering attributes applied include the
1040      * clip, transform, paint or color, composite and stroke attributes.
1041      * @param s The shape to be drawn.
1042      * @see #setStroke
1043      * @see #setPaint
1044      * @see java.awt.Graphics#setColor
1045      * @see #transform
1046      * @see #setTransform
1047      * @see #clip
1048      * @see #setClip




1008         int numGlyphs = font2D.getNumGlyphs();
1009         int missingGlyph = font2D.getMissingGlyphCode();
1010         char[] glyphToCharMap = new char[numGlyphs];
1011         int glyph;
1012 
1013         for (int i=0;i<numGlyphs; i++) {
1014             glyphToCharMap[i] = CharToGlyphMapper.INVISIBLE_GLYPH_ID;
1015         }
1016 
1017         /* Consider refining the ranges to try to map by asking the font
1018          * what ranges it supports.
1019          * Since a glyph may be mapped by multiple code points, and this
1020          * code can't handle that, we always prefer the earlier code point.
1021          */
1022         for (char c=0; c<0xFFFF; c++) {
1023            if (c >= CharToGlyphMapper.HI_SURROGATE_START &&
1024                c <= CharToGlyphMapper.LO_SURROGATE_END) {
1025                 continue;
1026             }
1027             glyph = font2D.charToGlyph(c);
1028             if (glyph != missingGlyph &&
1029                 glyph >= 0 && glyph < numGlyphs &&
1030                 (glyphToCharMap[glyph] ==
1031                  CharToGlyphMapper.INVISIBLE_GLYPH_ID)) {
1032                 glyphToCharMap[glyph] = c;
1033             }
1034         }
1035         return glyphToCharMap;
1036     }
1037 
1038     /**
1039      * Strokes the outline of a Shape using the settings of the current
1040      * graphics state.  The rendering attributes applied include the
1041      * clip, transform, paint or color, composite and stroke attributes.
1042      * @param s The shape to be drawn.
1043      * @see #setStroke
1044      * @see #setPaint
1045      * @see java.awt.Graphics#setColor
1046      * @see #transform
1047      * @see #setTransform
1048      * @see #clip
1049      * @see #setClip