gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz/gzz/vob GLTextStyle.java


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz/gzz/vob GLTextStyle.java
Date: Sat, 19 Oct 2002 10:29:13 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        02/10/19 10:29:13

Modified files:
        gzz/vob        : GLTextStyle.java 

Log message:
        Fix the semantics: when at size 20, don't return stuff for size 1. 
TextVob size is different.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/GLTextStyle.java.diff?tr1=1.14&tr2=1.15&r1=text&r2=text

Patches:
Index: gzz/gzz/vob/GLTextStyle.java
diff -c gzz/gzz/vob/GLTextStyle.java:1.14 gzz/gzz/vob/GLTextStyle.java:1.15
*** gzz/gzz/vob/GLTextStyle.java:1.14   Mon Oct  7 13:47:55 2002
--- gzz/gzz/vob/GLTextStyle.java        Sat Oct 19 10:29:13 2002
***************
*** 33,45 ****
   * it's much better to use GraphicsAPI.getTextStyle.
   */
  public class GLTextStyle extends TextStyle {
! public static final String rcsid = "$Id: GLTextStyle.java,v 1.14 2002/10/07 
17:47:55 tjl Exp $";
      public static boolean dbg = false;
      private static void pa(String s) { System.err.println(s); }
  
  
  
      static GL.Font theStaticFont;
      static GLTextStyle[] instances = new GLTextStyle[250];
  
      static public GLTextStyle create(String family, int style, int size) {
--- 33,46 ----
   * it's much better to use GraphicsAPI.getTextStyle.
   */
  public class GLTextStyle extends TextStyle {
! public static final String rcsid = "$Id: GLTextStyle.java,v 1.15 2002/10/19 
14:29:13 tjl Exp $";
      public static boolean dbg = false;
      private static void pa(String s) { System.err.println(s); }
  
  
  
      static GL.Font theStaticFont;
+     static float[] charWidths = new float[256];
      static GLTextStyle[] instances = new GLTextStyle[250];
  
      static public GLTextStyle create(String family, int style, int size) {
***************
*** 48,54 ****
        if(s == null) {
            if(theStaticFont == null)
                theStaticFont = GL.createFont("gfx/fonts/a010013l.pfb", 64);
!           s = new GLTextStyle(theStaticFont, 1);
            instances[size] = s;
        }
        return s;
--- 49,59 ----
        if(s == null) {
            if(theStaticFont == null)
                theStaticFont = GL.createFont("gfx/fonts/a010013l.pfb", 64);
!           theStaticFont.getWidths(charWidths);
!           if(dbg) for(int i=0; i<256; i++) {
!               pa("char '"+((char)i)+"': width "+charWidths[i]);
!           }
!           s = new GLTextStyle(theStaticFont, size);
            instances[size] = s;
        }
        return s;
***************
*** 57,71 ****
  
      float fontScale;
      GL.Font theFont;
-     float[] charWidths = new float[256];
  
      private GLTextStyle(GL.Font f, float scale) {
        this.theFont = f;
        this.fontScale = scale;
-       f.getWidths(charWidths);
-       if(dbg) for(int i=0; i<256; i++) {
-           pa("char '"+((char)i)+"': width "+charWidths[i]);
-       }
      }
  
      public float getScaleByHeight(float h) {
--- 62,71 ----
***************
*** 73,79 ****
      }
  
      private float getWidth(String s) {
!       int sum = 0;
        for(int i=0; i<s.length(); i++) {
            char c = s.charAt(i);
            if(c < charWidths.length)
--- 73,79 ----
      }
  
      private float getWidth(String s) {
!       float sum = 0;
        for(int i=0; i<s.length(); i++) {
            char c = s.charAt(i);
            if(c < charWidths.length)
***************
*** 82,88 ****
        return sum * fontScale;
      }
      private float getWidth(char[] chars, int offs, int len) {
!       int sum = 0;
        for(int i=offs; i<offs+len; i++) {
            char c = chars[i];
            if(c < charWidths.length)
--- 82,88 ----
        return sum * fontScale;
      }
      private float getWidth(char[] chars, int offs, int len) {
!       float sum = 0;
        for(int i=offs; i<offs+len; i++) {
            char c = chars[i];
            if(c < charWidths.length)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]