[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
Keith Packard
commit at keithp.com
Fri Sep 24 23:42:36 PDT 2004
- Previous message: [Commit]
twin ChangeLog, 1.4, 1.5 Makefile.am, 1.3, 1.4 twin.h, 1.4,
1.5 twin_convolve.c, 1.3, 1.4 twin_font.c, 1.1,
1.2 twin_glyphs.c, 1.1, 1.2 twin_hull.c, NONE,
1.1 twin_primitive.c, 1.1.1.1, 1.2 twin_spline.c, 1.1,
1.2 xtwin.c, 1.4, 1.5
- Next message: [Commit]
twin ChangeLog, 1.6, 1.7 twin_font.c, 1.3, 1.4 xtwin.c, 1.6, 1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: keithp
Update of /local/src/CVS/twin
In directory home.keithp.com:/tmp/cvs-serv26128
Modified Files:
ChangeLog Makefile.am twin.h twin_font.c twin_glyphs.c
twinint.h xtwin.c
Removed Files:
twin_vera.c
Log Message:
2004-09-24 Keith Packard <keithp at keithp.com>
* Makefile.am:
* twin.h:
Switch to just supporting stroke fonts
* twin_font.c: (twin_has_ucs4), (_twin_ucs4_base),
(_twin_ucs4_points), (twin_path_ucs4), (twin_ucs4_width),
(twin_path_string):
Finish needed stroke font API.
* twin_glyphs.c:
Elimiate all but ascii glyphs, use offset table to
eliminate table of pointers (which can't be const)
* twin_vera.c:
Remove twin_vera.c
* twinint.h:
Change glyph structures around for offsets and ascii only
* xtwin.c: (main):
Few more cases to show ascii text support
Index: ChangeLog
===================================================================
RCS file: /local/src/CVS/twin/ChangeLog,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- ChangeLog 25 Sep 2004 01:10:00 -0000 1.5
+++ ChangeLog 25 Sep 2004 06:41:19 -0000 1.6
@@ -1,6 +1,29 @@
2004-09-24 Keith Packard <keithp at keithp.com>
* Makefile.am:
+ * twin.h:
+ Switch to just supporting stroke fonts
+ * twin_font.c: (twin_has_ucs4), (_twin_ucs4_base),
+ (_twin_ucs4_points), (twin_path_ucs4), (twin_ucs4_width),
+ (twin_path_string):
+ Finish needed stroke font API.
+
+ * twin_glyphs.c:
+ Elimiate all but ascii glyphs, use offset table to
+ eliminate table of pointers (which can't be const)
+
+ * twin_vera.c:
+ Remove twin_vera.c
+
+ * twinint.h:
+ Change glyph structures around for offsets and ascii only
+
+ * xtwin.c: (main):
+ Few more cases to show ascii text support
+
+2004-09-24 Keith Packard <keithp at keithp.com>
+
+ * Makefile.am:
* twin_hull.c: (_twin_slope_init), (_twin_hull_create),
(_twin_slope_compare), (_twin_hull_vertex_compare),
(_twin_hull_prev_valid), (_twin_hull_next_valid),
Index: Makefile.am
===================================================================
RCS file: /local/src/CVS/twin/Makefile.am,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- Makefile.am 25 Sep 2004 01:10:00 -0000 1.4
+++ Makefile.am 25 Sep 2004 06:41:19 -0000 1.5
@@ -29,7 +29,6 @@
twin_primitive.c \
twin_screen.c \
twin_spline.c \
- twin_vera.c \
twin_x11.c \
twinint.h \
xtwin.c
Index: twin.h
===================================================================
RCS file: /local/src/CVS/twin/twin.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- twin.h 25 Sep 2004 01:10:00 -0000 1.5
+++ twin.h 25 Sep 2004 06:41:19 -0000 1.6
@@ -210,17 +210,17 @@
*/
twin_bool_t
-twin_has_glyph (int glyph);
+twin_has_ucs4 (twin_ucs4_t ucs4);
void
-twin_path_glyph (twin_path_t *path,
- twin_fixed_t scale_x,
- twin_fixed_t scale_y,
- int style,
- int glyph);
+twin_path_ucs4 (twin_path_t *path,
+ twin_fixed_t scale_x,
+ twin_fixed_t scale_y,
+ int style,
+ twin_ucs4_t ucs4);
int
-twin_glyph_width (int glyph, twin_fixed_t scale_x);
+twin_ucs4_width (twin_ucs4_t ucs4, twin_fixed_t scale_x);
#define TWIN_TEXT_ROMAN 0
#define TWIN_TEXT_BOLD 1
@@ -231,8 +231,9 @@
twin_fixed_t scale_x,
twin_fixed_t scale_y,
int style,
- unsigned char *string);
+ const char *string);
+#if 0
void
twin_path_ucs4 (twin_path_t *path, twin_fixed_t scale_x,
twin_fixed_t scale_y, twin_ucs4_t ucs4);
@@ -240,6 +241,7 @@
void
twin_path_utf8 (twin_path_t *path, twin_fixed_t scale_x, twin_fixed_t scale_y,
const char *string);
+#endif
/*
* twin_hull.c
Index: twin_font.c
===================================================================
RCS file: /local/src/CVS/twin/twin_font.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- twin_font.c 25 Sep 2004 01:10:00 -0000 1.2
+++ twin_font.c 25 Sep 2004 06:41:19 -0000 1.3
@@ -33,9 +33,9 @@
#define SY(y) (((y) * scale_y) >> 5)
twin_bool_t
-twin_has_glyph (int glyph)
+twin_has_ucs4 (twin_ucs4_t ucs4)
{
- return _twin_font[glyph] != NULL;
+ return ucs4 <= TWIN_FONT_MAX && _twin_glyph_offsets[ucs4] != 0;
}
static int
@@ -104,14 +104,37 @@
return nsnap;
}
+static const twin_gpoint_t *
+_twin_ucs4_base(twin_ucs4_t ucs4)
+{
+ if (ucs4 > TWIN_FONT_MAX) ucs4 = 0;
+
+ 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_glyph (twin_path_t *path,
- twin_fixed_t scale_x,
- twin_fixed_t scale_y,
- int style,
- int glyph)
+twin_path_ucs4 (twin_path_t *path,
+ twin_fixed_t scale_x,
+ twin_fixed_t scale_y,
+ int style,
+ twin_ucs4_t ucs4)
{
- const twin_gpoint_t *p = _twin_font[glyph];
+ const twin_gpoint_t *p = 0;
int i;
twin_fixed_t xo, yo;
twin_fixed_t xc, yc;
@@ -123,8 +146,40 @@
int nsnap_x, nsnap_y;
int npoints;
- if (!p)
- return;
+ 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);
@@ -215,121 +270,18 @@
free (snap_x);
- xo = xo + twin_glyph_width (glyph, scale_x);
+ xo = xo + twin_ucs4_width (ucs4, scale_x);
twin_path_move (path, xo, yo);
}
int
-twin_glyph_width (int glyph, twin_fixed_t scale_x)
+twin_ucs4_width (twin_ucs4_t ucs4, twin_fixed_t scale_x)
{
- const twin_gpoint_t *p = _twin_font[glyph];
-
- if (!p)
- return 0;
-
- return twin_fixed_ceil (SX (p[0].y) - SX (p[0].x));
-}
-
-extern const uint16_t _twin_unicode[];
+ const twin_gpoint_t *p;
-void
-twin_path_string (twin_path_t *path,
- twin_fixed_t scale_x,
- twin_fixed_t scale_y,
- int style,
- unsigned char *string)
-{
- unsigned char c;
-
- while ((c = *string++))
- {
- uint16_t g = _twin_unicode[c];
-
- if (g)
- twin_path_glyph (path, scale_x, scale_y, style, g);
- }
-}
-
-extern twin_font_t twin_Bitstream_Vera_Sans_Roman;
-
-#define gw(f) ((twin_fixed_t) ((twin_dfixed_t) (f) * scale_x) >> 6)
-#define gx(f) (((twin_fixed_t) ((twin_dfixed_t) (f) * scale_x) >> 6) + origin.x)
-#define gy(f) (-((twin_fixed_t) ((twin_dfixed_t) (f) * scale_y) >> 6) + origin.y)
-
-static void
-twin_path_fglyph (twin_path_t *path,
- twin_fixed_t scale_x,
- twin_fixed_t scale_y,
- const char *glyph)
-{
- twin_point_t c, c1, c2, to;
- twin_point_t from;
- twin_point_t origin;
- twin_fixed_t width;
+ p = _twin_ucs4_base (ucs4);
- width = *glyph++;
- twin_path_cur_point (path, &origin.x, &origin.y);
- for (;;) {
- switch (*glyph++) {
- case 'm':
- to.x = gx (*glyph++);
- to.y = gy (*glyph++);
- twin_path_move (path, to.x, to.y);
- break;
- case 'l':
- to.x = gx (*glyph++);
- to.y = gy (*glyph++);
- twin_path_draw (path, to.x, to.y);
- break;
- case '2':
- twin_path_cur_point (path, &from.x, &from.y);
- c.x = gx (*glyph++);
- c.y = gy (*glyph++);
- to.x = gx (*glyph++);
- to.y = gy (*glyph++);
- c1.x = from.x + 2 * (c.x - from.x) / 3;
- c1.y = from.y + 2 * (c.y - from.y) / 3;
- c2.x = to.x + 2 * (c.x - to.x) / 3;
- c2.y = to.y + 2 * (c.y - to.y) / 3;
- twin_path_curve (path, c1.x, c1.y, c2.x, c2.y, to.x, to.y);
- break;
- case '3':
- c1.x = gx (*glyph++);
- c1.y = gy (*glyph++);
- c2.x = gx (*glyph++);
- c2.y = gy (*glyph++);
- to.x = gx (*glyph++);
- to.y = gy (*glyph++);
- twin_path_curve (path, c1.x, c1.y, c2.x, c2.y, to.x, to.y);
- break;
- case 'e':
- twin_path_move (path, gx(width), gy(0));
- return;
- }
- }
-}
-
-void
-twin_path_ucs4 (twin_path_t *path,
- twin_fixed_t scale_x,
- twin_fixed_t scale_y,
- twin_ucs4_t ucs4)
-{
- int page = ucs4 >> TWIN_UCS_PAGE_SHIFT;
- int off = ucs4 & (TWIN_UCS_PER_PAGE - 1);
- int p;
- uint16_t o;
- twin_font_t *font = &twin_Bitstream_Vera_Sans_Roman;
-
- for (p = 0; p < font->ncharmap; p++)
- if (font->charmap[p].page == page)
- {
- o = font->charmap[p].offsets[off];
- if (o)
- {
- twin_path_fglyph (path, scale_x, scale_y, font->outlines + o - 1);
- }
- }
+ return twin_fixed_ceil (SX (p[0].y) - SX (p[0].x));
}
static int
@@ -401,17 +353,18 @@
}
void
-twin_path_utf8 (twin_path_t *path,
- twin_fixed_t scale_x,
- twin_fixed_t scale_y,
- const char *string)
+twin_path_string (twin_path_t *path,
+ twin_fixed_t scale_x,
+ twin_fixed_t scale_y,
+ int style,
+ const char *string)
{
int len;
twin_ucs4_t ucs4;
while ((len = _twin_utf8_to_ucs4(string, &ucs4)) > 0)
{
- twin_path_ucs4 (path, scale_x, scale_y, ucs4);
+ twin_path_ucs4 (path, scale_x, scale_y, style, ucs4);
string += len;
}
}
Index: twin_glyphs.c
===================================================================
RCS file: /local/src/CVS/twin/twin_glyphs.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- twin_glyphs.c 25 Sep 2004 01:10:00 -0000 1.2
+++ twin_glyphs.c 25 Sep 2004 06:41:19 -0000 1.3
@@ -24,57752 +24,425 @@
#include "twinint.h"
-/* glyphs: 1848 points: 51597 */
-static const twin_gpoint_t g2269[] = {
- { -12, 12 },
- { 9, -15 },
- { 8, -14 },
- { 9, -13 },
- { 10, -14 },
- { 10, -15 },
[...58124 lines suppressed...]
+ 211, 230, 236, 252, 269, 277, 296, 321,
+/* 0x38 */
+ 328, 359, 384, 397, 413, 418, 425, 430,
+/* 0x40 */
+ 452, 509, 519, 544, 564, 581, 594, 604,
+/* 0x48 */
+ 628, 638, 642, 654, 664, 671, 684, 694,
+/* 0x50 */
+ 717, 732, 758, 776, 798, 805, 817, 824,
+/* 0x58 */
+ 837, 844, 852, 862, 868, 872, 878, 885,
+/* 0x60 */
+ 889, 898, 917, 936, 952, 971, 990, 1000,
+/* 0x68 */
+ 1024, 1036, 1046, 1059, 1069, 1073, 1093, 1105,
+/* 0x70 */
+ 1124, 1143, 1162, 1172, 1191, 1201, 1213, 1220,
+/* 0x78 */
+ 1233, 1240, 1251, 1261, 1274, 1278, 1291, 0,
};
--- twin_vera.c DELETED ---
Index: twinint.h
===================================================================
RCS file: /local/src/CVS/twin/twinint.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- twinint.h 24 Sep 2004 04:09:11 -0000 1.4
+++ twinint.h 25 Sep 2004 06:41:19 -0000 1.5
@@ -277,7 +277,13 @@
typedef struct _twin_gpoint { twin_gfixed_t x, y; } twin_gpoint_t;
-extern const twin_gpoint_t *_twin_font[];
+#define TWIN_FONT_MAX 0x7f
+
+extern const twin_gpoint_t *_twin_font[TWIN_FONT_MAX + 1];
+extern const twin_gpoint_t *_twin_default_char;
+
+extern const twin_gpoint_t _twin_glyphs[];
+extern const uint16_t _twin_glyph_offsets[];
#define TWIN_UCS_PAGE_SHIFT 7
#define TWIN_UCS_PER_PAGE (1 << TWIN_UCS_PAGE_SHIFT)
Index: xtwin.c
===================================================================
RCS file: /local/src/CVS/twin/xtwin.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- xtwin.c 25 Sep 2004 01:10:01 -0000 1.5
+++ xtwin.c 25 Sep 2004 06:41:19 -0000 1.6
@@ -62,27 +62,55 @@
twin_fill (alpha, 0x00000000, TWIN_SOURCE, 0, 0, 512, 512);
path = twin_path_create ();
+#if 0
+ twin_path_move (path, D(3), D(0));
+ for (g = 0; g < 4326; g++)
+ {
+ 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)
+ twin_path_move (path, D(3), fy + D(10));
+ twin_path_glyph (path, D(10), D(10), TWIN_TEXT_ROMAN,
+ glyph);
+ }
+#endif
#if 1
fx = D(3);
- fy = D(8);
- for (g = 10; g < 20; g++)
+ fy = D(10);
+ for (g = 10; g < 40; g += 2)
{
#if 1
+ twin_path_move (path, fx, fy);
+ twin_path_string (path, D(g), D(g), TWIN_TEXT_ROMAN,
+ " !\"#$%&'()*+,-./0123456789:;<=>?");
+ fy += D(g);
+ twin_path_move (path, fx, fy);
+ twin_path_string (path, D(g), D(g), TWIN_TEXT_ROMAN,
+ "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_");
+ fy += D(g);
+ twin_path_move (path, fx, fy);
+ twin_path_string (path, D(g), D(g), TWIN_TEXT_ROMAN,
+ "`abcdefghijklmnopqrstuvwxyz{|}~");
+ fy += D(g);
+#endif
+#if 0
for (s = 0; s < 4; s++)
{
- 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);
}
-#else
+#endif
+#if 0
twin_path_string (path, D(g), D(g), "t");
fy += D(g);
#endif
}
-#else
+#endif
+#if 0
fx = D(3);
fy = D(8);
for (g = 6; g < 36; g++)
- Previous message: [Commit]
twin ChangeLog, 1.4, 1.5 Makefile.am, 1.3, 1.4 twin.h, 1.4,
1.5 twin_convolve.c, 1.3, 1.4 twin_font.c, 1.1,
1.2 twin_glyphs.c, 1.1, 1.2 twin_hull.c, NONE,
1.1 twin_primitive.c, 1.1.1.1, 1.2 twin_spline.c, 1.1,
1.2 xtwin.c, 1.4, 1.5
- Next message: [Commit]
twin ChangeLog, 1.6, 1.7 twin_font.c, 1.3, 1.4 xtwin.c, 1.6, 1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Commit
mailing list