[Commit]
twin ChangeLog, 1.6, 1.7 twin_font.c, 1.3, 1.4 xtwin.c, 1.6, 1.7
Keith Packard
commit at keithp.com
Sat Sep 25 00:29:44 PDT 2004
- Previous message: [Commit]
twin ChangeLog, 1.5, 1.6 Makefile.am, 1.4, 1.5 twin.h, 1.5,
1.6 twin_font.c, 1.2, 1.3 twin_glyphs.c, 1.2, 1.3 twin_vera.c,
1.1, NONE twinint.h, 1.4, 1.5 xtwin.c, 1.5, 1.6
- Next message: [Commit] twin ChangeLog,1.7,1.8 twin_font.c,1.4,1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: keithp
Update of /local/src/CVS/twin
In directory home.keithp.com:/tmp/cvs-serv27636
Modified Files:
ChangeLog twin_font.c xtwin.c
Log Message:
2004-09-25 Keith Packard <keithp at keithp.com>
* twin_font.c: (_snap), (twin_path_ucs4):
Reduce emboldening to +50% stroke thickness.
Clean up debug code.
Eliminate some dead code.
Try to adjust width computations a bit. Still not right.
* xtwin.c: (main):
draw in more colors
Index: ChangeLog
===================================================================
RCS file: /local/src/CVS/twin/ChangeLog,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ChangeLog 25 Sep 2004 06:41:19 -0000 1.6
+++ ChangeLog 25 Sep 2004 07:29:42 -0000 1.7
@@ -1,3 +1,13 @@
+2004-09-25 Keith Packard <keithp at keithp.com>
+
+ * twin_font.c: (_snap), (twin_path_ucs4):
+ Reduce emboldening to +50% stroke thickness.
+ Clean up debug code.
+ Eliminate some dead code.
+ Try to adjust width computations a bit. Still not right.
+ * xtwin.c: (main):
+ draw in more colors
+
2004-09-24 Keith Packard <keithp at keithp.com>
* Makefile.am:
Index: twin_font.c
===================================================================
RCS file: /local/src/CVS/twin/twin_font.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- twin_font.c 25 Sep 2004 06:41:19 -0000 1.3
+++ twin_font.c 25 Sep 2004 07:29:42 -0000 1.4
@@ -24,9 +24,13 @@
#include "twinint.h"
+#if 0
#include <stdio.h>
-
#define F(x) twin_fixed_to_double(x)
+#define DBGOUT(x) printf x
+#else
+#define DBGOUT(x)
+#endif
#define S(f,s) ((twin_fixed_t) ((((twin_dfixed_t) (f) * (s)) >> 5)))
#define SX(x) (((x) * scale_x) >> 5)
@@ -72,20 +76,16 @@
twin_fixed_t dist_after = after - v;
twin_fixed_t move = ((twin_dfixed_t) dist_before * move_after +
(twin_dfixed_t) dist_after * move_before) / dist;
-#if 0
- printf ("%d <= %d <= %d\n", snap[s], g, snap[s+1]);
- printf ("%9.4f <= %9.4f <= %9.4f\n", F(before), F(v), F(after));
- printf ("before: %9.4f -> %9.4f\n", F(before), F(snap_before));
- printf ("after: %9.4f -> %9.4f\n", F(after), F(snap_after));
- printf ("v: %9.4f -> %9.4f\n", F(v), F(v+move));
-#endif
+ DBGOUT (("%d <= %d <= %d\n", snap[s], g, snap[s+1]));
+ DBGOUT (("%9.4f <= %9.4f <= %9.4f\n", F(before), F(v), F(after)));
+ DBGOUT (("before: %9.4f -> %9.4f\n", F(before), F(snap_before)));
+ DBGOUT (("after: %9.4f -> %9.4f\n", F(after), F(snap_after)));
+ DBGOUT (("v: %9.4f -> %9.4f\n", F(v), F(v+move)));
v += move;
break;
}
}
-#if 0
- printf ("_snap: %d => %9.4f\n", g, F(v));
-#endif
+ DBGOUT (("_snap: %d => %9.4f\n", g, F(v)));
return v;
}
@@ -112,21 +112,6 @@
return _twin_glyphs + _twin_glyph_offsets[ucs4];
}
-#if 0
-static int
-_twin_ucs4_points (twin_ucs4_t ucs4)
-{
- const twin_gpoint_t *p;
- int i;
-
- if (ucs4 > 0x7f || (p = _twin_font[ucs4]) == NULL)
- p = _twin_default_char;
-
- for (i = 0; p[i].y != -64; i++);
- return i + 1;
-}
-#endif
-
void
twin_path_ucs4 (twin_path_t *path,
twin_fixed_t scale_x,
@@ -146,39 +131,6 @@
int nsnap_x, nsnap_y;
int npoints;
- static int been_here = 0;
-
-#if 0
- if (!been_here)
- {
- int off = _twin_ucs4_points (0);
- int this;
- been_here = 1;
- for (i = 0; i <= 0x7f; i++)
- {
- if ((i & 7) == 0)
- {
- printf ("/* 0x%02x */\n", i);
- printf (" ");
- }
- if (twin_has_ucs4 (i))
- {
- this = _twin_ucs4_points (i);
- printf ("%4d,", off);
- off += this;
- }
- else
- {
- printf ("%4d,", 0);
- }
- if ((i&7) == 7)
- printf ("\n");
- else
- printf (" ");
- }
- }
-#endif
-
p = _twin_ucs4_base (ucs4);
twin_path_cur_point (path, &xo, &yo);
@@ -221,28 +173,32 @@
qsort (snap_y, nsnap_y, sizeof (twin_gfixed_t), compare_snap);
#if 0
- printf ("snap_x:");
+ DBGOUT (("snap_x:"));
for (i = 0; i < nsnap_x; i++)
- printf (" %d", snap_x[i]);
- printf ("\n");
+ DBGOUT ((" %d", snap_x[i]));
+ DBGOUT (("\n"));
- printf ("snap_y:");
+ DBGOUT (("snap_y:");
for (i = 0; i < nsnap_y; i++)
- printf (" %d", snap_y[i]);
- printf ("\n");
+ DBGOUT ((" %d", snap_y[i]));
+ DBGOUT (("\n"));
#endif
stroke = twin_path_create ();
/* snap pen size to half integer value */
- if (style & TWIN_TEXT_BOLD)
- pen_size = SNAPH(scale_y / 12);
- else
- pen_size = SNAPH(scale_y / 24);
-
+ pen_size = SNAPH(scale_y / 24);
if (pen_size < TWIN_FIXED_HALF)
pen_size = TWIN_FIXED_HALF;
+ if (style & TWIN_TEXT_BOLD)
+ {
+ twin_fixed_t pen_add = SNAPH(pen_size >> 1);
+ if (pen_add == 0)
+ pen_add = TWIN_FIXED_HALF;
+ pen_size += pen_add;
+ }
+
pen_adjust = pen_size & TWIN_FIXED_HALF;
pen = twin_path_create ();
@@ -277,11 +233,13 @@
int
twin_ucs4_width (twin_ucs4_t ucs4, twin_fixed_t scale_x)
{
- const twin_gpoint_t *p;
+ const twin_gpoint_t *p = _twin_ucs4_base (ucs4);
+ twin_fixed_t left, right;
- p = _twin_ucs4_base (ucs4);
+ left = SNAPI(SX (p[0].x));
+ right = SNAPI(SX (p[0].y));
- return twin_fixed_ceil (SX (p[0].y) - SX (p[0].x));
+ return right - left;
}
static int
@@ -368,3 +326,4 @@
string += len;
}
}
+)
Index: xtwin.c
===================================================================
RCS file: /local/src/CVS/twin/xtwin.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- xtwin.c 25 Sep 2004 06:41:19 -0000 1.6
+++ xtwin.c 25 Sep 2004 07:29:42 -0000 1.7
@@ -40,10 +40,10 @@
main (int argc, char **argv)
{
Display *dpy = XOpenDisplay (0);
- twin_x11_t *x11 = twin_x11_create (dpy, 512, 512);
- twin_pixmap_t *red = twin_pixmap_create (TWIN_ARGB32, 512, 512);
+ twin_x11_t *x11 = twin_x11_create (dpy, 1024, 512);
+ twin_pixmap_t *red = twin_pixmap_create (TWIN_ARGB32, 1024, 512);
twin_pixmap_t *blue = twin_pixmap_create (TWIN_ARGB32, 100, 100);
- twin_pixmap_t *alpha = twin_pixmap_create (TWIN_A8, 512, 512);
+ twin_pixmap_t *alpha = twin_pixmap_create (TWIN_A8, 1024, 512);
twin_operand_t source, mask;
twin_path_t *path;
twin_path_t *pen;
@@ -56,10 +56,10 @@
int s;
pen = twin_path_create ();
- twin_path_circle (pen, D (0.5));
+ twin_path_circle (pen, D (1));
- twin_fill (red, 0x00000000, TWIN_SOURCE, 0, 0, 512, 512);
- twin_fill (alpha, 0x00000000, TWIN_SOURCE, 0, 0, 512, 512);
+ twin_fill (red, 0x00000000, TWIN_SOURCE, 0, 0, 1024, 512);
+ twin_fill (alpha, 0x00000000, TWIN_SOURCE, 0, 0, 1024, 512);
path = twin_path_create ();
#if 0
@@ -69,7 +69,7 @@
int glyph = g;
if (!twin_has_glyph (glyph)) glyph = 0;
twin_path_cur_point (path, &fx, &fy);
- if (fx + twin_glyph_width (glyph, D(10)) >= D(512) || g % 50 == 0)
+ if (fx + twin_glyph_width (glyph, D(10)) >= D(1024) || g % 50 == 0)
twin_path_move (path, D(3), fy + D(10));
twin_path_glyph (path, D(10), D(10), TWIN_TEXT_ROMAN,
glyph);
@@ -77,36 +77,37 @@
#endif
#if 1
fx = D(3);
- fy = D(10);
- for (g = 10; g < 40; g += 2)
+ fy = 0;
+ for (g = 8; g < 30; g += 4)
{
-#if 1
+#if 0
+ fy += D(g+2);
twin_path_move (path, fx, fy);
twin_path_string (path, D(g), D(g), TWIN_TEXT_ROMAN,
" !\"#$%&'()*+,-./0123456789:;<=>?");
- fy += D(g);
+ fy += D(g+2);
twin_path_move (path, fx, fy);
twin_path_string (path, D(g), D(g), TWIN_TEXT_ROMAN,
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_");
- fy += D(g);
+ fy += D(g+2);
twin_path_move (path, fx, fy);
twin_path_string (path, D(g), D(g), TWIN_TEXT_ROMAN,
"`abcdefghijklmnopqrstuvwxyz{|}~");
- fy += D(g);
#endif
-#if 0
+#if 1
for (s = 0; s < 4; s++)
{
+ fy += D(g+2);
+ twin_path_move (path, fx, fy);
twin_path_string (path, D(g), D(g), styles[s],
"the quick brown fox jumps over the lazy dog.");
twin_path_string (path, D(g), D(g), styles[s],
"THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.");
- fy += D(g);
}
#endif
#if 0
- twin_path_string (path, D(g), D(g), "t");
fy += D(g);
+ twin_path_string (path, D(g), D(g), "t");
#endif
}
#endif
@@ -132,10 +133,9 @@
mask.source_kind = TWIN_PIXMAP;
mask.u.pixmap = alpha;
twin_composite (red, 0, 0, &source, 0, 0, &mask, 0, 0, TWIN_OVER,
- 512, 512);
+ 1024, 512);
twin_fill (blue, 0x00000000, TWIN_SOURCE, 0, 0, 100, 100);
- twin_fill (alpha, 0x00000000, TWIN_SOURCE, 0, 0, 100, 100);
#if 1
path = twin_path_create ();
@@ -151,14 +151,36 @@
twin_path_convolve (path, stroke, pen);
twin_path_destroy (stroke);
+ twin_fill (alpha, 0x00000000, TWIN_SOURCE, 0, 0, 100, 100);
twin_path_fill (alpha, path);
+ source.source_kind = TWIN_SOLID;
+ source.u.argb = 0xff00ff00;
+ mask.source_kind = TWIN_PIXMAP;
+ mask.u.pixmap = alpha;
+ twin_composite (blue, 0, 0, &source, 0, 0, &mask, 0, 0, TWIN_OVER,
+ 100, 100);
+
twin_path_destroy (path);
path = twin_path_create ();
+ stroke = twin_path_create ();
- twin_path_move (path, D (50), D (50));
- twin_path_curve (path, D (70), D (70), D (80), D (70), D (100), D (50));
+ twin_path_move (stroke, D (50), D (50));
+ twin_path_curve (stroke, D (70), D (70), D (80), D (70), D (100), D (50));
+ twin_fill (alpha, 0x00000000, TWIN_SOURCE, 0, 0, 100, 100);
+ twin_path_fill (alpha, stroke);
+
+ source.source_kind = TWIN_SOLID;
+ source.u.argb = 0xffff0000;
+ mask.source_kind = TWIN_PIXMAP;
+ mask.u.pixmap = alpha;
+ twin_composite (blue, 0, 0, &source, 0, 0, &mask, 0, 0, TWIN_OVER,
+ 100, 100);
+
+ twin_path_convolve (path, stroke, pen);
+
+ twin_fill (alpha, 0x00000000, TWIN_SOURCE, 0, 0, 100, 100);
twin_path_fill (alpha, path);
source.source_kind = TWIN_SOLID;
@@ -172,7 +194,7 @@
twin_pixmap_move (red, 0, 0);
twin_pixmap_move (blue, 100, 100);
twin_pixmap_show (red, x11->screen, 0);
-/* twin_pixmap_show (blue, x11->screen, 0); */
+ twin_pixmap_show (blue, x11->screen, 0);
had_motion = TWIN_FALSE;
for (;;)
{
- Previous message: [Commit]
twin ChangeLog, 1.5, 1.6 Makefile.am, 1.4, 1.5 twin.h, 1.5,
1.6 twin_font.c, 1.2, 1.3 twin_glyphs.c, 1.2, 1.3 twin_vera.c,
1.1, NONE twinint.h, 1.4, 1.5 xtwin.c, 1.5, 1.6
- Next message: [Commit] twin ChangeLog,1.7,1.8 twin_font.c,1.4,1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Commit
mailing list