[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz gfx/librenderables/renderables.py gzz/view/...
From: |
Benja Fallenstein |
Subject: |
[Gzz-commits] gzz gfx/librenderables/renderables.py gzz/view/... |
Date: |
Sun, 29 Sep 2002 12:21:12 -0400 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Benja Fallenstein <address@hidden> 02/09/29 12:21:12
Modified files:
gfx/librenderables: renderables.py
gzz/view : TextCellContentView.java
gzz/vob : TextVob.java
Log message:
text better
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.83&tr2=1.84&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/TextCellContentView.java.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/TextVob.java.diff?tr1=1.33&tr2=1.34&r1=text&r2=text
Patches:
Index: gzz/gfx/librenderables/renderables.py
diff -c gzz/gfx/librenderables/renderables.py:1.83
gzz/gfx/librenderables/renderables.py:1.84
*** gzz/gfx/librenderables/renderables.py:1.83 Sun Sep 29 10:53:45 2002
--- gzz/gfx/librenderables/renderables.py Sun Sep 29 12:21:11 2002
***************
*** 840,890 ****
},
# Draw horizontal text with origin and scale from one coordsys and
! # width and height from another
! # (XXX ignores w and h so far -> should consider in scaling)
{
"Type": "2",
"Name": "HorizText2",
"Data": """
TextRenderer *r;
unistring txt;
! ZPt origin;
! float h1;
int magic;
""",
"Params" : """
Font f,
! String text, float x, float y, float z,
! float h1, int magic
""",
"ParamCode" : """
r = f;
! txt = text; origin.x = x; origin.y = y; origin.z = z;
! this->h1 = h1;
! this->magic = magic;
""",
"ExtraClass" : """
template<class Coords> struct Vertexer {
const Coords &c;
float scale;
! ZPt orig;
! Vertexer(Coords &c, float scale, ZPt orig) : c(c), scale(scale),
orig(orig) { }
template<class T> void operator()(const T &x, const T &y) {
! ZPt tmp(x - orig.x, y - orig.y, 0);
! //tmp.x *= scale; tmp.y *= scale;
! tmp.x += orig.x; tmp.y += orig.y;
c.vertex(tmp);
}
};
""",
"RenderCode" : """
! Vertexer<Coords> v(coords1, h1, origin);
glPushAttrib(GL_ENABLE_BIT);
glEnable(GL_BLEND);
switch(magic) {
case 0:
Text::renderIter(*r, txt.begin(), txt.end(),
! origin.x,origin.y,
v
);
break;
--- 840,897 ----
},
# Draw horizontal text with origin and scale from one coordsys and
! # width and height from another.
{
"Type": "2",
"Name": "HorizText2",
"Data": """
TextRenderer *r;
unistring txt;
! float height, ascent, scale;
int magic;
""",
"Params" : """
Font f,
! String text, float height, float ascent,
! float scale, int magic
""",
"ParamCode" : """
r = f;
! txt = text;
! this->height = height;
! this->ascent = ascent;
! this->scale = scale;
! this->magic = magic;
""",
"ExtraClass" : """
template<class Coords> struct Vertexer {
const Coords &c;
float scale;
! float orig_y;
! Vertexer(Coords &c, float scale, float orig_y) : c(c),
scale(scale), orig_y(orig_y) { }
template<class T> void operator()(const T &x, const T &y) {
! ZPt tmp(x + 1, y - orig_y + 1, 0);
! tmp.x *= scale; tmp.y *= scale;
! tmp.x -= 1; tmp.y += orig_y - 1;
c.vertex(tmp);
}
};
""",
"RenderCode" : """
! ZPt box(2,2,0); // compensate for -1/1 coordsys
! box = coords2.transform(box);
!
! float y = box.y/2 - (height-ascent)/4;
! Vertexer<Coords> v(coords1, scale, y);
!
! DBG(dbg_horiztext2) << box << " " << ascent << " " << y << "\\n";
!
glPushAttrib(GL_ENABLE_BIT);
glEnable(GL_BLEND);
switch(magic) {
case 0:
Text::renderIter(*r, txt.begin(), txt.end(),
! 0, y,
v
);
break;
***************
*** 893,899 ****
static char buffer[100];
sprintf(buffer, "FPS %2.2f", fps);
Text::renderIter(*r, buffer, buffer+strlen(buffer),
! origin.x,origin.y,
v
);
break;
--- 900,906 ----
static char buffer[100];
sprintf(buffer, "FPS %2.2f", fps);
Text::renderIter(*r, buffer, buffer+strlen(buffer),
! 0, y,
v
);
break;
Index: gzz/gzz/view/TextCellContentView.java
diff -c gzz/gzz/view/TextCellContentView.java:1.14
gzz/gzz/view/TextCellContentView.java:1.15
*** gzz/gzz/view/TextCellContentView.java:1.14 Sun Sep 29 10:53:45 2002
--- gzz/gzz/view/TextCellContentView.java Sun Sep 29 12:21:11 2002
***************
*** 37,43 ****
*/
public class TextCellContentView implements CellContentView {
! public static final String rcsid = "$Id: TextCellContentView.java,v 1.14
2002/09/29 14:53:45 benja Exp $";
public static boolean dbg = false;
private static void p(String s) { if(dbg) pa(s); }
private static void pa(String s) { System.err.println(s); }
--- 37,43 ----
*/
public class TextCellContentView implements CellContentView {
! public static final String rcsid = "$Id: TextCellContentView.java,v 1.15
2002/09/29 16:21:11 benja Exp $";
public static boolean dbg = false;
private static void p(String s) { if(dbg) pa(s); }
private static void pa(String s) { System.err.println(s); }
***************
*** 51,57 ****
this.style = style;
}
- static Rectangle box = new Rectangle();
public void place(Cell c, VobScene v, int cs, float w, float h,
ViewContext context, float scale) {
String s = c.t();
--- 51,56 ----
***************
*** 89,95 ****
Object key = (line < KEY.length) ? KEY[line] : new Integer(line+1);
int skewedcs = v.coordsys(cs, key, 0, skew, 0, 2, 2);
! placeVob(c, v, skewedcs, w, box.height, brBefore, brAfter, offs,
context, scale);
}
static Object WH_KEY = new Object();
--- 88,94 ----
Object key = (line < KEY.length) ? KEY[line] : new Integer(line+1);
int skewedcs = v.coordsys(cs, key, 0, skew, 0, 2, 2);
! placeVob(c, v, skewedcs, w, h, brBefore, brAfter, offs, context,
scale);
}
static Object WH_KEY = new Object();
Index: gzz/gzz/vob/TextVob.java
diff -c gzz/gzz/vob/TextVob.java:1.33 gzz/gzz/vob/TextVob.java:1.34
*** gzz/gzz/vob/TextVob.java:1.33 Sun Sep 29 10:53:45 2002
--- gzz/gzz/vob/TextVob.java Sun Sep 29 12:21:12 2002
***************
*** 31,37 ****
* from these and use a LineBreaker.
*/
public class TextVob extends HBox.VobHBox {
! String rcsid = "$Id: TextVob.java,v 1.33 2002/09/29 14:53:45 benja Exp $";
public static boolean dbg = false;
private static void pa(String s) { System.err.println(s); }
--- 31,37 ----
* from these and use a LineBreaker.
*/
public class TextVob extends HBox.VobHBox {
! String rcsid = "$Id: TextVob.java,v 1.34 2002/09/29 16:21:12 benja Exp $";
public static boolean dbg = false;
private static void pa(String s) { System.err.println(s); }
***************
*** 113,126 ****
int coordsys2) {
if(dbg) pa("Addtolistgl text "+text);
if(ht == null) {
- float sh = scale;
- // float sw = 2.0f/style.getWidth(text, 1);
GLTextStyle gls = (GLTextStyle)style;
ht = GLRen.createHorizText2(
gls.theFont,
! text,
! -1, sh*style.getAscent(1)-1, 0,
! sh, 0);
}
if(cl == null) {
cl = GLRen.createCallList("Color 0 0 0 1");
--- 113,123 ----
int coordsys2) {
if(dbg) pa("Addtolistgl text "+text);
if(ht == null) {
GLTextStyle gls = (GLTextStyle)style;
ht = GLRen.createHorizText2(
gls.theFont,
! text, gls.theFont.getHeight(), gls.theFont.getYOffs(),
! scale * gls.fontScale, 0);
}
if(cl == null) {
cl = GLRen.createCallList("Color 0 0 0 1");