Java Code Examples for sun.font.GlyphList

Following code examples demonstrate how to use sun.font.GlyphListfrom java. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use sun.font.GlyphListand various code implementation of this class.

   protected void drawGlyphList(SunGraphics2D sg2d, GlyphList gl) {
       sg2d.loops.drawGlyphListAALoop.DrawGlyphListAA(sg2d, sg2d.surfaceData,
                                                      gl);
   } 


  
  public void DrawGlyphList(SunGraphics2D paramSunGraphics2D, SurfaceData paramSurfaceData, GlyphList paramGlyphList)
  {
    PixelWriter localPixelWriter = GeneralRenderer.createXorPixelWriter(paramSunGraphics2D, paramSurfaceData);
    GeneralRenderer.doDrawGlyphList(paramSurfaceData, localPixelWriter, paramGlyphList, paramSunGraphics2D.getCompClip());
  } 

    protected void drawGlyphList(SunGraphics2D sg2d, GlyphList gl) {
        sg2d.loops.drawGlyphListLCDLoop.
            DrawGlyphListLCD(sg2d, sg2d.surfaceData, gl);
    } 

Advertisement
Javadoc
This class represents a list of actual renderable glyphs. It can be constructed from a number of tex

t sources, representing the various ways in which a programmer can ask a Graphics2D object to render some text. Once constructed, it provides a way of iterating through the device metrics and graybits of the individual glyphs that need to be rendered to the screen. Note that this class holds pointers to native data which must be disposed. It is not marked as finalizable since it is intended to be very lightweight and finalization is a comparitively expensive procedure. The caller must specifically use try{ finally{ to manually ensure that the object is disposed after use, otherwise native data structures might be leaked. Here is a code sample for using this class: public void drawString(String str, FontInfo info, float x, float y) { GlyphList gl = GlyphList.getInstance(); try { gl.setFromString(info, str, x, y); int strbounds[] = gl.getBounds(); int numglyphs = gl.getNumGlyphs(); for (int i = 0; i < numglyphs; i++) { gl.setGlyphIndex(i); int metrics[] = gl.getMetrics(); byte bits[] = gl.getGrayBits(); int glyphx = metrics[0]; int glyphy = metrics[1]; int glyphw = metrics[2]; int glyphh = metrics[3]; int off = 0; for (int j = 0; j < glyphh; j++) { for (int i = 0; i < glyphw; i++) { int dx = glyphx + i; int dy = glyphy + j; int alpha = bits[off++]; drawPixel(alpha, dx, dy); finally { gl.dispose();

Read More
Advertisement