gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/gzz/view TextCellContentView.java


From: Benja Fallenstein
Subject: [Gzz-commits] gzz/gzz/view TextCellContentView.java
Date: Mon, 25 Nov 2002 19:30:24 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Benja Fallenstein <address@hidden>      02/11/25 19:30:24

Modified files:
        gzz/view       : TextCellContentView.java 

Log message:
        bug chasing

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/TextCellContentView.java.diff?tr1=1.28&tr2=1.29&r1=text&r2=text

Patches:
Index: gzz/gzz/view/TextCellContentView.java
diff -u gzz/gzz/view/TextCellContentView.java:1.28 
gzz/gzz/view/TextCellContentView.java:1.29
--- gzz/gzz/view/TextCellContentView.java:1.28  Mon Nov 25 11:03:39 2002
+++ gzz/gzz/view/TextCellContentView.java       Mon Nov 25 19:30:23 2002
@@ -39,7 +39,7 @@
  */
 
 public class TextCellContentView extends CellContentView {
-public static final String rcsid = "$Id: TextCellContentView.java,v 1.28 
2002/11/25 16:03:39 humppake Exp $";
+public static final String rcsid = "$Id: TextCellContentView.java,v 1.29 
2002/11/26 00:30:23 benja Exp $";
     public static boolean dbg = false;
     private static void pa(String s) { System.err.println(s); }
 
@@ -94,15 +94,19 @@
         offs -= brBefore;
         center -= brBefore;
 
-       float scale = 1; // XXX use getFontSize
+       vs.coords.getSqSize(box, boxwh);
+        float middle = boxwh[0] / 2.0f;
+       float scale = style.getScaleByHeight(boxwh[1]);
+
+       if(dbg) {
+           pa("scaled_h: "+boxwh[1]);
+           pa("scale: "+scale);
+       }
 
         float width = style.getWidth(s, scale);
         float left = style.getWidth(s.substring(0, center), scale);
         float right = width - left;
 
-       vs.coords.getSqSize(box, boxwh);
-        float middle = boxwh[0] / 2.0f;
-
        // Possibly offset text so cursor is visible.
         float textOffset;
         if(width < boxwh[0]) textOffset = 0;
@@ -113,22 +117,22 @@
         Object key = (line < KEY.length) ? KEY[line] : new Integer(line+1);
         int offsetcs = vs.orthoCS(box, key, 0, textOffset, 0, 1, 1);
 
-        placeVob(c, vs, offsetcs, boxwh[0], boxwh[1], brBefore, brAfter, offs, 
context, scale);
+        placeVob(c, vs, offsetcs, brBefore, brAfter, offs, context, boxwh[1]);
     }
 
     static Object WH_KEY = new Object();
     static Object CURS_KEY = new Object();
     LineVob cursorVob = new LineVob(0, 0, 0, 1, Color.black);
-    protected void placeVob(Cell c, VobScene vs, int cs, float w, float h, int 
start, int end,
-                            int offs, ViewContext context, float scale) {
+    protected void placeVob(Cell c, VobScene vs, int cs, int start, int end,
+                            int offs, ViewContext context, float scaled_h) {
            // XXX should optimize for common case: no substring()
         TextVob vob = new TextVob(style, c.t().substring(start, end));
-       float scaled_h = vob.getHeight(scale) + vob.getDepth(scale);
         int cs_scaled = vs.orthoCS(cs, WH_KEY, 0, 0, 0, scaled_h, scaled_h);
         vs.map.put(vob, cs_scaled);
 
         if(offs >= 0 && offs >= start && offs <= end) {
-           float x = style.getWidth(c.t().substring(start, offs), 1);
+           float xscale = style.getScaleByHeight(scaled_h);
+           float x = style.getWidth(c.t().substring(start, offs), xscale);
            int cs_cursor = vs.orthoCS(cs, CURS_KEY, -1, x+1, 0, 0,scaled_h);
             // v.map.put(new TextCursorVob(vob, offs), cs);
            vs.map.put(cursorVob, cs_cursor);




reply via email to

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