Package org.toyz.litetext

Examples of org.toyz.litetext.Glyph


          // TODO Auto-generated catch block
          e1.printStackTrace();
        }
        continue;
      }
      Glyph g = new Glyph();
      g.setWidth(Integer.parseInt(gprops.getProperty("width")));
      g.setHeight(Integer.parseInt(gprops.getProperty("height")));
      g.setX(Integer.parseInt(gprops.getProperty("x")));
      g.setY(Integer.parseInt(gprops.getProperty("y")));
      g.setXadd(Integer.parseInt(gprops.getProperty("xadd")));

      try {
        in.close();
      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      try {
                InputStream is = FontUtils.class.getResourceAsStream("/fonts/" + fontname + "/glyph_bmap." + i);
                g.setBmap(getBytesFromInputStream(is, g.getWidth() * g.getHeight()));
//        g.setBmap(getBytesFromFile(new File("fonts/" + fontname + "/glyph_bmap." + i)));
      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        return null;
View Full Code Here


      boolean no_chars_yet;
         /* logical: we haven't seen any renderable characters yet in
        the line.
     */
   Glyph lastGlyph = null;
     /* Glyph of last character processed so far.  Undefined if
        'no_chars_yet'.
     */

   no_chars_yet = true;   /* initial value */
   bwid = 0/* initial value */
   accumulated_ics = (float) 0.0/* initial value */
  
    for (cursor = 0; cursor < line.length(); cursor++) {
       
        Glyph g = font.getGlyph((int)line.charAt(cursor));   
        if (g == null) {
          g = font.getGlyph(' ');
        }
        if (g != null) {
            if (no_chars_yet) {
                no_chars_yet = false;
                if (g.getX() < 0)
                    backup_space_needed = -g.getX();
                else {
                    backup_space_needed = 0;
                    bwid += g.getX();
                }
            } else {
                /* handle extra intercharacter space (-space option) */
                int full_pixels;  /* integer part of accumulated_ics */
                accumulated_ics += intercharacter_space;
                full_pixels = (int) accumulated_ics;
                bwid += full_pixels;
                accumulated_ics -= full_pixels;
            }
            lastGlyph = g;
            bwid += g.getXadd();
        }      
    }
    if (no_chars_yet)
        /* Line has no renderable characters */
        backup_space_needed = 0;
View Full Code Here

      leftcol = leftmargin;
      accumulated_ics = (float) 0.0; /* initial value */

      for (cursor = 0; cursor < lines[line].length(); ++cursor) {
        int glyphIndex = (int) lines[line].charAt(cursor);
        Glyph glyph; /* the glyph for this character */

        glyph = font.getGlyph(glyphIndex);
        if (glyph == null) {
          glyph = font.getGlyph(' ');
        }
        if (glyph != null) {
          int toprow = row + font.getMaxheight() + font.getY()
              - glyph.getHeight() - glyph.getY();
          /* row number in image of top row in glyph */

          insert_character(glyph, toprow, leftcol, bits);

          leftcol += glyph.getXadd();
          {
            /* handle extra intercharacter space (-space option) */
            int full_pixels; /* integer part of accumulated_ics */
            accumulated_ics += intercharacter_space;
            full_pixels = (int) accumulated_ics;
View Full Code Here

TOP

Related Classes of org.toyz.litetext.Glyph

Copyright © 2018 www.massapicom. 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.