mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-23 20:01:22 +00:00
update impl for DPSshow to handle xshow, yshow, xyshow, ashow, widthshow, and awidthshow
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@20989 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a1859fe2d5
commit
4e5fe7c3ac
5 changed files with 362 additions and 57 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2005-03-29 Adrian Robert <arobert@cogsci.ucsd.edu>
|
||||||
|
|
||||||
|
* Source/art/ftfont.h, Source/art/ftfont.m, Source/art/ftfont-old.m:
|
||||||
|
Support DPSxshow, xyshow, ashow, widthshow, and awidthshow in same
|
||||||
|
drawString:... method that was just implementing DPSshow, and drop
|
||||||
|
the stub that was slated to handle the former methods.
|
||||||
|
* Source/art/ARTContext.m: Use the methods defined above.
|
||||||
|
|
||||||
2005-03-28 Richard Frith-Macdonald <rfm@gnu.org>
|
2005-03-28 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/win32/WIN32Server.m: fix for locating window at point.
|
* Source/win32/WIN32Server.m: fix for locating window at point.
|
||||||
|
|
|
@ -54,12 +54,6 @@ of crashing, they just print a warning.
|
||||||
toPoint: (NSPoint)aPoint
|
toPoint: (NSPoint)aPoint
|
||||||
delta: (float)delta
|
delta: (float)delta
|
||||||
|
|
||||||
- (void) DPSashow: (float)x : (float)y : (const char*)s
|
|
||||||
- (void) DPSawidthshow: (float)cx : (float)cy : (int)c : (float)ax : (float)ay
|
|
||||||
- (void) DPSwidthshow: (float)x : (float)y : (int)c : (const char*)s
|
|
||||||
DPSxshow, DPSyshow, DPSxyshow
|
|
||||||
|
|
||||||
|
|
||||||
** Other unimplemented stuff **
|
** Other unimplemented stuff **
|
||||||
|
|
||||||
FontInfo:
|
FontInfo:
|
||||||
|
@ -187,17 +181,67 @@ very expensive
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
/* Text operations */
|
/* Text operations */
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
- (void) DPSashow: (float)x : (float)y : (const char*)s
|
- (void) DPSashow: (float)ax : (float)ay : (const char*)s
|
||||||
{ /* TODO: adds (x,y) in user space to each glyph's x/y advancement */
|
{ /* adds (x,y) in user space to each glyph's x/y advancement */
|
||||||
NSLog(@"ignoring DPSashow: %g : %g : '%s'",x,y,s);
|
NSPoint p;
|
||||||
|
int x, y;
|
||||||
|
float numarray[2];
|
||||||
|
|
||||||
|
if (!wi || !wi->data) return;
|
||||||
|
if (all_clipped)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ([path isEmpty]) return;
|
||||||
|
p = [path currentPoint];
|
||||||
|
|
||||||
|
numarray[0] = ax; numarray[1] = ay;
|
||||||
|
|
||||||
|
x = p.x;
|
||||||
|
y = wi->sy - p.y;
|
||||||
|
[(id<FTFontInfo>)font
|
||||||
|
drawString: s
|
||||||
|
at: x:y
|
||||||
|
to: clip_x0:clip_y0:clip_x1:clip_y1 : CLIP_DATA : wi->bytes_per_line
|
||||||
|
: (wi->has_alpha? wi->alpha + clip_x0 + clip_y0 * wi->sx : NULL) : wi->sx
|
||||||
|
color: fill_color[0]:fill_color[1]:fill_color[2]:fill_color[3]
|
||||||
|
transform: ctm
|
||||||
|
deltas: numarray : 1 : 4
|
||||||
|
widthChar: 0
|
||||||
|
drawinfo: &DI];
|
||||||
|
UPDATE_UNBUFFERED
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSawidthshow: (float)cx : (float)cy : (int)c : (float)ax : (float)ay
|
- (void) DPSawidthshow: (float)cx : (float)cy : (int)c : (float)ax : (float)ay
|
||||||
: (const char*)s
|
: (const char*)s
|
||||||
{ /* TODO: add (ax,ay) in user space to each glyph's x/y advancement and
|
{ /* adds (ax,ay) in user space to every glyph's advancement and (cx,cy)
|
||||||
additionally add (cx,cy) to the character c's advancement */
|
to character c's x/y advancement */
|
||||||
NSLog(@"ignoring DPSawidthshow: %g : %g : %i : %g : %g : '%s'",
|
NSPoint p;
|
||||||
cx,cy,c,ax,ay,s);
|
int x, y;
|
||||||
|
float numarray[4];
|
||||||
|
|
||||||
|
if (!wi || !wi->data) return;
|
||||||
|
if (all_clipped)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ([path isEmpty]) return;
|
||||||
|
p = [path currentPoint];
|
||||||
|
|
||||||
|
numarray[0] = ax; numarray[1] = ay;
|
||||||
|
numarray[2] = cx; numarray[3] = cy;
|
||||||
|
|
||||||
|
x = p.x;
|
||||||
|
y = wi->sy - p.y;
|
||||||
|
[(id<FTFontInfo>)font
|
||||||
|
drawString: s
|
||||||
|
at: x:y
|
||||||
|
to: clip_x0:clip_y0:clip_x1:clip_y1 : CLIP_DATA : wi->bytes_per_line
|
||||||
|
: (wi->has_alpha? wi->alpha + clip_x0 + clip_y0 * wi->sx : NULL) : wi->sx
|
||||||
|
color: fill_color[0]:fill_color[1]:fill_color[2]:fill_color[3]
|
||||||
|
transform: ctm
|
||||||
|
deltas: numarray : 1 : 12
|
||||||
|
widthChar: c
|
||||||
|
drawinfo: &DI];
|
||||||
|
UPDATE_UNBUFFERED
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPScharpath: (const char*)s : (int)b
|
- (void) DPScharpath: (const char*)s : (int)b
|
||||||
|
@ -235,13 +279,40 @@ very expensive
|
||||||
: (wi->has_alpha? wi->alpha + clip_x0 + clip_y0 * wi->sx : NULL) : wi->sx
|
: (wi->has_alpha? wi->alpha + clip_x0 + clip_y0 * wi->sx : NULL) : wi->sx
|
||||||
color: fill_color[0]:fill_color[1]:fill_color[2]:fill_color[3]
|
color: fill_color[0]:fill_color[1]:fill_color[2]:fill_color[3]
|
||||||
transform: ctm
|
transform: ctm
|
||||||
|
deltas: NULL : 0 : 0
|
||||||
|
widthChar: 0
|
||||||
drawinfo: &DI];
|
drawinfo: &DI];
|
||||||
UPDATE_UNBUFFERED
|
UPDATE_UNBUFFERED
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSwidthshow: (float)x : (float)y : (int)c : (const char*)s
|
- (void) DPSwidthshow: (float)cx : (float)cy : (int)c : (const char*)s
|
||||||
{ /* TODO: add (x,y) user-space to the character c's advancement */
|
{ /* adds (x,y) in user space to character c's x/y advancement */
|
||||||
NSLog(@"ignoring DPSwidthshow: %g : %g : %i : '%s'",x,y,c,s);
|
NSPoint p;
|
||||||
|
int x, y;
|
||||||
|
float numarray[2];
|
||||||
|
|
||||||
|
if (!wi || !wi->data) return;
|
||||||
|
if (all_clipped)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ([path isEmpty]) return;
|
||||||
|
p = [path currentPoint];
|
||||||
|
|
||||||
|
numarray[0] = cx; numarray[1] = cy;
|
||||||
|
|
||||||
|
x = p.x;
|
||||||
|
y = wi->sy - p.y;
|
||||||
|
[(id<FTFontInfo>)font
|
||||||
|
drawString: s
|
||||||
|
at: x:y
|
||||||
|
to: clip_x0:clip_y0:clip_x1:clip_y1 : CLIP_DATA : wi->bytes_per_line
|
||||||
|
: (wi->has_alpha? wi->alpha + clip_x0 + clip_y0 * wi->sx : NULL) : wi->sx
|
||||||
|
color: fill_color[0]:fill_color[1]:fill_color[2]:fill_color[3]
|
||||||
|
transform: ctm
|
||||||
|
deltas: numarray : 1 : 8
|
||||||
|
widthChar: c
|
||||||
|
drawinfo: &DI];
|
||||||
|
UPDATE_UNBUFFERED
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSxshow: (const char*)s : (const float*)numarray : (int)size
|
- (void) DPSxshow: (const char*)s : (const float*)numarray : (int)size
|
||||||
|
@ -262,9 +333,12 @@ very expensive
|
||||||
drawString: s
|
drawString: s
|
||||||
at: x:y
|
at: x:y
|
||||||
to: clip_x0:clip_y0:clip_x1:clip_y1 : CLIP_DATA : wi->bytes_per_line
|
to: clip_x0:clip_y0:clip_x1:clip_y1 : CLIP_DATA : wi->bytes_per_line
|
||||||
|
: (wi->has_alpha? wi->alpha + clip_x0 + clip_y0 * wi->sx : NULL) : wi->sx
|
||||||
color: fill_color[0]:fill_color[1]:fill_color[2]:fill_color[3]
|
color: fill_color[0]:fill_color[1]:fill_color[2]:fill_color[3]
|
||||||
transform: ctm
|
transform: ctm
|
||||||
deltas: numarray : size : 1];
|
deltas: numarray : size : 1
|
||||||
|
widthChar: 0
|
||||||
|
drawinfo: &DI];
|
||||||
UPDATE_UNBUFFERED
|
UPDATE_UNBUFFERED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,9 +360,12 @@ very expensive
|
||||||
drawString: s
|
drawString: s
|
||||||
at: x:y
|
at: x:y
|
||||||
to: clip_x0:clip_y0:clip_x1:clip_y1 : CLIP_DATA : wi->bytes_per_line
|
to: clip_x0:clip_y0:clip_x1:clip_y1 : CLIP_DATA : wi->bytes_per_line
|
||||||
|
: (wi->has_alpha? wi->alpha + clip_x0 + clip_y0 * wi->sx : NULL) : wi->sx
|
||||||
color: fill_color[0]:fill_color[1]:fill_color[2]:fill_color[3]
|
color: fill_color[0]:fill_color[1]:fill_color[2]:fill_color[3]
|
||||||
transform: ctm
|
transform: ctm
|
||||||
deltas: numarray : size : 3];
|
deltas: numarray : size : 3
|
||||||
|
widthChar: 0
|
||||||
|
drawinfo: &DI];
|
||||||
UPDATE_UNBUFFERED
|
UPDATE_UNBUFFERED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,9 +387,12 @@ very expensive
|
||||||
drawString: s
|
drawString: s
|
||||||
at: x:y
|
at: x:y
|
||||||
to: clip_x0:clip_y0:clip_x1:clip_y1 : CLIP_DATA : wi->bytes_per_line
|
to: clip_x0:clip_y0:clip_x1:clip_y1 : CLIP_DATA : wi->bytes_per_line
|
||||||
|
: (wi->has_alpha? wi->alpha + clip_x0 + clip_y0 * wi->sx : NULL) : wi->sx
|
||||||
color: fill_color[0]:fill_color[1]:fill_color[2]:fill_color[3]
|
color: fill_color[0]:fill_color[1]:fill_color[2]:fill_color[3]
|
||||||
transform: ctm
|
transform: ctm
|
||||||
deltas: numarray : size : 2];
|
deltas: numarray : size : 2
|
||||||
|
widthChar: 0
|
||||||
|
drawinfo: &DI];
|
||||||
UPDATE_UNBUFFERED
|
UPDATE_UNBUFFERED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -874,17 +874,18 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_
|
||||||
|
|
||||||
/* TODO: the current point probably needs updating after drawing is done */
|
/* TODO: the current point probably needs updating after drawing is done */
|
||||||
|
|
||||||
-(void) drawString: (const char *)s
|
/* draw string at point, clipped, w/given color and alpha, and possible deltas:
|
||||||
at: (int)x:(int)y
|
flags & 0x1: data contains x offsets, use instead of glyph x advance
|
||||||
to: (int)x0:(int)y0:(int)x1:(int)y1:(unsigned char *)buf:(int)bpl
|
flags & 0x2: data contains y offsets, use instead of glyph y advance
|
||||||
color:(unsigned char)r:(unsigned char)g:(unsigned char)b:(unsigned char)alpha
|
flags & 0x4: data contains a single x and y offset, which should be added to
|
||||||
transform: (NSAffineTransform *)transform
|
font's advancements for each glyph; results are undefined if
|
||||||
deltas: (const float *)delta_data : (int)delta_size : (int)delta_flags;
|
this option is combined with either x or y offsets (0x1,0x2)
|
||||||
{
|
flags & 0x8: data contains a single x and y offset, which should be added to
|
||||||
/* TODO */
|
font's advancement for glyph identified by 'wch'; if combined
|
||||||
}
|
with 0x4 deltas contain exactly two offsets for x and y, the
|
||||||
|
first for every character, the second for 'wch'; results are
|
||||||
|
undefined if 0x8 is combined with 0x2 or 0x1
|
||||||
|
*/
|
||||||
-(void) drawString: (const char *)s
|
-(void) drawString: (const char *)s
|
||||||
at: (int)x : (int)y
|
at: (int)x : (int)y
|
||||||
to: (int)x0 : (int)y0 : (int)x1 : (int)y1
|
to: (int)x0 : (int)y0 : (int)x1 : (int)y1
|
||||||
|
@ -892,6 +893,8 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_
|
||||||
: (unsigned char *)abuf : (int)abpl
|
: (unsigned char *)abuf : (int)abpl
|
||||||
color:(unsigned char)r : (unsigned char)g : (unsigned char)b : (unsigned char)alpha
|
color:(unsigned char)r : (unsigned char)g : (unsigned char)b : (unsigned char)alpha
|
||||||
transform: (NSAffineTransform *)transform
|
transform: (NSAffineTransform *)transform
|
||||||
|
deltas: (const float *)delta_data : (int)delta_size : (int)delta_flags
|
||||||
|
widthChar: (int) wch
|
||||||
drawinfo: (draw_info_t *)di
|
drawinfo: (draw_info_t *)di
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -900,6 +903,7 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_
|
||||||
const unsigned char *c;
|
const unsigned char *c;
|
||||||
unsigned char ch;
|
unsigned char ch;
|
||||||
unsigned int uch;
|
unsigned int uch;
|
||||||
|
int d;
|
||||||
|
|
||||||
FTC_CMapDescRec cmap;
|
FTC_CMapDescRec cmap;
|
||||||
unsigned int glyph;
|
unsigned int glyph;
|
||||||
|
@ -1034,6 +1038,7 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_
|
||||||
cmap.face_id = imgd.font.face_id;
|
cmap.face_id = imgd.font.face_id;
|
||||||
cmap.u.encoding = ft_encoding_unicode;
|
cmap.u.encoding = ft_encoding_unicode;
|
||||||
cmap.type = FTC_CMAP_BY_ENCODING;
|
cmap.type = FTC_CMAP_BY_ENCODING;
|
||||||
|
d=0;
|
||||||
|
|
||||||
for (c = s; *c; c++)
|
for (c = s; *c; c++)
|
||||||
{
|
{
|
||||||
|
@ -1109,7 +1114,44 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_
|
||||||
|
|
||||||
if (!sbit->buffer)
|
if (!sbit->buffer)
|
||||||
{
|
{
|
||||||
x += sbit->xadvance;
|
if (!delta_flags)
|
||||||
|
{
|
||||||
|
x += sbit->xadvance;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (delta_flags & 0x1)
|
||||||
|
x += delta_data[d++];
|
||||||
|
if (delta_flags & 0x2)
|
||||||
|
y += (transform->matrix.m22 < 0) ?
|
||||||
|
delta_data[d++] : -delta_data[d++];
|
||||||
|
if (delta_flags & 0x4)
|
||||||
|
{
|
||||||
|
x += sbit->xadvance + delta_data[0];
|
||||||
|
y += /*sbit->yadvance +*/ (transform->matrix.m22 < 0) ?
|
||||||
|
delta_data[1] : -delta_data[1];
|
||||||
|
if ((delta_flags & 0x8) && (uch == wch))
|
||||||
|
{
|
||||||
|
x += delta_data[2];
|
||||||
|
y += (transform->matrix.m22 < 0) ?
|
||||||
|
delta_data[3] : -delta_data[3];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (delta_flags & 0x8)
|
||||||
|
{
|
||||||
|
if (uch == wch)
|
||||||
|
{
|
||||||
|
x += sbit->xadvance + delta_data[0];
|
||||||
|
y += /*sbit->yadvance +*/ (transform->matrix.m22 < 0) ?
|
||||||
|
delta_data[1] : -delta_data[1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x += sbit->xadvance;
|
||||||
|
/*y += sbit->yadvance;*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1218,7 +1260,44 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_
|
||||||
NSLog(@"unhandled font bitmap format %i", sbit->format);
|
NSLog(@"unhandled font bitmap format %i", sbit->format);
|
||||||
}
|
}
|
||||||
|
|
||||||
x += sbit->xadvance;
|
if (!delta_flags)
|
||||||
|
{
|
||||||
|
x += sbit->xadvance;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (delta_flags & 0x1)
|
||||||
|
x += delta_data[d++];
|
||||||
|
if (delta_flags & 0x2)
|
||||||
|
y += (transform->matrix.m22 < 0) ?
|
||||||
|
delta_data[d++] : -delta_data[d++];
|
||||||
|
if (delta_flags & 0x4)
|
||||||
|
{
|
||||||
|
x += sbit->xadvance + delta_data[0];
|
||||||
|
y += /*sbit->yadvance +*/ (transform->matrix.m22 < 0) ?
|
||||||
|
delta_data[1] : -delta_data[1];
|
||||||
|
if ((delta_flags & 0x8) && (uch == wch))
|
||||||
|
{
|
||||||
|
x += delta_data[2];
|
||||||
|
y += (transform->matrix.m22 < 0) ?
|
||||||
|
delta_data[3] : -delta_data[3];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (delta_flags & 0x8)
|
||||||
|
{
|
||||||
|
if (uch == wch)
|
||||||
|
{
|
||||||
|
x += sbit->xadvance + delta_data[0];
|
||||||
|
y += /*sbit->yadvance +*/ (transform->matrix.m22 < 0) ?
|
||||||
|
delta_data[1] : -delta_data[1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x += sbit->xadvance;
|
||||||
|
/*y += sbit->yadvance;*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1324,8 +1403,41 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_
|
||||||
NSLog(@"unhandled font bitmap format %i", gb->bitmap.pixel_mode);
|
NSLog(@"unhandled font bitmap format %i", gb->bitmap.pixel_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
ftdelta.x += gl->advance.x >> 10;
|
if (!delta_flags)
|
||||||
ftdelta.y += gl->advance.y >> 10;
|
{
|
||||||
|
ftdelta.x += gl->advance.x >> 10;
|
||||||
|
ftdelta.y += gl->advance.y >> 10;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (delta_flags & 0x1)
|
||||||
|
ftdelta.x += delta_data[d++] * 64.0;
|
||||||
|
if (delta_flags & 0x2)
|
||||||
|
ftdelta.y += delta_data[d++] * 64.0;
|
||||||
|
if (delta_flags & 0x4)
|
||||||
|
{
|
||||||
|
ftdelta.x += (gl->advance.x >> 10) + delta_data[0] * 64.0;
|
||||||
|
ftdelta.y += (gl->advance.y >> 10) + delta_data[1] * 64.0;
|
||||||
|
if ((delta_flags & 0x8) && (uch == wch))
|
||||||
|
{
|
||||||
|
ftdelta.x += delta_data[2] * 64.0;
|
||||||
|
ftdelta.y += delta_data[3] * 64.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (delta_flags & 0x8)
|
||||||
|
{
|
||||||
|
if (uch == wch)
|
||||||
|
{
|
||||||
|
ftdelta.x += (gl->advance.x>>10) + delta_data[0] * 64.0;
|
||||||
|
ftdelta.y += (gl->advance.y>>10) + delta_data[1] * 64.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ftdelta.x += gl->advance.x >> 10;
|
||||||
|
ftdelta.y += gl->advance.y >> 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FT_Done_Glyph(gl);
|
FT_Done_Glyph(gl);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
color: (unsigned char)r : (unsigned char)g : (unsigned char)b
|
color: (unsigned char)r : (unsigned char)g : (unsigned char)b
|
||||||
: (unsigned char)alpha
|
: (unsigned char)alpha
|
||||||
transform: (NSAffineTransform *)transform
|
transform: (NSAffineTransform *)transform
|
||||||
|
deltas: (const float *)delta_data : (int)delta_size : (int)delta_flags
|
||||||
|
widthChar: (int) wch
|
||||||
drawinfo: (struct draw_info_s *)di;
|
drawinfo: (struct draw_info_s *)di;
|
||||||
|
|
||||||
-(void) drawGlyphs: (const NSGlyph *)glyphs : (int)length
|
-(void) drawGlyphs: (const NSGlyph *)glyphs : (int)length
|
||||||
|
@ -55,14 +57,6 @@
|
||||||
transform: (NSAffineTransform *)transform
|
transform: (NSAffineTransform *)transform
|
||||||
drawinfo: (struct draw_info_s *)di;
|
drawinfo: (struct draw_info_s *)di;
|
||||||
|
|
||||||
/* TODO: see if this is really necessary */
|
|
||||||
-(void) drawString: (const char *)s
|
|
||||||
at: (int)x:(int)y
|
|
||||||
to: (int)x0:(int)y0:(int)x1:(int)y1:(unsigned char *)buf:(int)bpl
|
|
||||||
color:(unsigned char)r:(unsigned char)g:(unsigned char)b:(unsigned char)alpha
|
|
||||||
transform: (NSAffineTransform *)transform
|
|
||||||
deltas: (const float *)delta_data : (int)delta_size : (int)delta_flags;
|
|
||||||
|
|
||||||
-(void) outlineString: (const char *)s
|
-(void) outlineString: (const char *)s
|
||||||
at: (float)x : (float)y
|
at: (float)x : (float)y
|
||||||
gstate: (void *)func_param;
|
gstate: (void *)func_param;
|
||||||
|
|
|
@ -873,17 +873,18 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_
|
||||||
|
|
||||||
/* TODO: the current point probably needs updating after drawing is done */
|
/* TODO: the current point probably needs updating after drawing is done */
|
||||||
|
|
||||||
-(void) drawString: (const char *)s
|
/* draw string at point, clipped, w/given color and alpha, and possible deltas:
|
||||||
at: (int)x:(int)y
|
flags & 0x1: data contains x offsets, use instead of glyph x advance
|
||||||
to: (int)x0:(int)y0:(int)x1:(int)y1:(unsigned char *)buf:(int)bpl
|
flags & 0x2: data contains y offsets, use instead of glyph y advance
|
||||||
color:(unsigned char)r:(unsigned char)g:(unsigned char)b:(unsigned char)alpha
|
flags & 0x4: data contains a single x and y offset, which should be added to
|
||||||
transform: (NSAffineTransform *)transform
|
font's advancements for each glyph; results are undefined if
|
||||||
deltas: (const float *)delta_data : (int)delta_size : (int)delta_flags;
|
this option is combined with either x or y offsets (0x1,0x2)
|
||||||
{
|
flags & 0x8: data contains a single x and y offset, which should be added to
|
||||||
/* TODO */
|
font's advancement for glyph identified by 'wch'; if combined
|
||||||
}
|
with 0x4 deltas contain exactly two offsets for x and y, the
|
||||||
|
first for every character, the second for 'wch'; results are
|
||||||
|
undefined if 0x8 is combined with 0x2 or 0x1
|
||||||
|
*/
|
||||||
-(void) drawString: (const char *)s
|
-(void) drawString: (const char *)s
|
||||||
at: (int)x : (int)y
|
at: (int)x : (int)y
|
||||||
to: (int)x0 : (int)y0 : (int)x1 : (int)y1
|
to: (int)x0 : (int)y0 : (int)x1 : (int)y1
|
||||||
|
@ -891,11 +892,14 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_
|
||||||
: (unsigned char *)abuf : (int)abpl
|
: (unsigned char *)abuf : (int)abpl
|
||||||
color:(unsigned char)r : (unsigned char)g : (unsigned char)b : (unsigned char)alpha
|
color:(unsigned char)r : (unsigned char)g : (unsigned char)b : (unsigned char)alpha
|
||||||
transform: (NSAffineTransform *)transform
|
transform: (NSAffineTransform *)transform
|
||||||
|
deltas: (const float *)delta_data : (int)delta_size : (int)delta_flags
|
||||||
|
widthChar: (int) wch
|
||||||
drawinfo: (draw_info_t *)di
|
drawinfo: (draw_info_t *)di
|
||||||
{
|
{
|
||||||
const unsigned char *c;
|
const unsigned char *c;
|
||||||
unsigned char ch;
|
unsigned char ch;
|
||||||
unsigned int uch;
|
unsigned int uch;
|
||||||
|
int d;
|
||||||
|
|
||||||
unsigned int glyph;
|
unsigned int glyph;
|
||||||
|
|
||||||
|
@ -1049,7 +1053,44 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_
|
||||||
|
|
||||||
if (!sbit->buffer)
|
if (!sbit->buffer)
|
||||||
{
|
{
|
||||||
x += sbit->xadvance;
|
if (!delta_flags)
|
||||||
|
{
|
||||||
|
x += sbit->xadvance;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (delta_flags & 0x1)
|
||||||
|
x += delta_data[d++];
|
||||||
|
if (delta_flags & 0x2)
|
||||||
|
y += (transform->matrix.m22 < 0) ?
|
||||||
|
delta_data[d++] : -delta_data[d++];
|
||||||
|
if (delta_flags & 0x4)
|
||||||
|
{
|
||||||
|
x += sbit->xadvance + delta_data[0];
|
||||||
|
y += /*sbit->yadvance +*/ (transform->matrix.m22 < 0) ?
|
||||||
|
delta_data[1] : -delta_data[1];
|
||||||
|
if ((delta_flags & 0x8) && (uch == wch))
|
||||||
|
{
|
||||||
|
x += delta_data[2];
|
||||||
|
y += (transform->matrix.m22 < 0) ?
|
||||||
|
delta_data[3] : -delta_data[3];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (delta_flags & 0x8)
|
||||||
|
{
|
||||||
|
if (uch == wch)
|
||||||
|
{
|
||||||
|
x += sbit->xadvance + delta_data[0];
|
||||||
|
y += /*sbit->yadvance +*/ (transform->matrix.m22 < 0) ?
|
||||||
|
delta_data[1] : -delta_data[1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x += sbit->xadvance;
|
||||||
|
/*y += sbit->yadvance;*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1158,7 +1199,44 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_
|
||||||
NSLog(@"unhandled font bitmap format %i", sbit->format);
|
NSLog(@"unhandled font bitmap format %i", sbit->format);
|
||||||
}
|
}
|
||||||
|
|
||||||
x += sbit->xadvance;
|
if (!delta_flags)
|
||||||
|
{
|
||||||
|
x += sbit->xadvance;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (delta_flags & 0x1)
|
||||||
|
x += delta_data[d++];
|
||||||
|
if (delta_flags & 0x2)
|
||||||
|
y += (transform->matrix.m22 < 0) ?
|
||||||
|
delta_data[d++] : -delta_data[d++];
|
||||||
|
if (delta_flags & 0x4)
|
||||||
|
{
|
||||||
|
x += sbit->xadvance + delta_data[0];
|
||||||
|
y += /*sbit->yadvance +*/ (transform->matrix.m22 < 0) ?
|
||||||
|
delta_data[1] : -delta_data[1];
|
||||||
|
if ((delta_flags & 0x8) && (uch == wch))
|
||||||
|
{
|
||||||
|
x += delta_data[2];
|
||||||
|
y += (transform->matrix.m22 < 0) ?
|
||||||
|
delta_data[3] : -delta_data[3];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (delta_flags & 0x8)
|
||||||
|
{
|
||||||
|
if (uch == wch)
|
||||||
|
{
|
||||||
|
x += sbit->xadvance + delta_data[0];
|
||||||
|
y += /*sbit->yadvance +*/ (transform->matrix.m22 < 0) ?
|
||||||
|
delta_data[1] : -delta_data[1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x += sbit->xadvance;
|
||||||
|
/*y += sbit->yadvance;*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1265,8 +1343,41 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_
|
||||||
NSLog(@"unhandled font bitmap format %i", gb->bitmap.pixel_mode);
|
NSLog(@"unhandled font bitmap format %i", gb->bitmap.pixel_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
ftdelta.x += gl->advance.x >> 10;
|
if (!delta_flags)
|
||||||
ftdelta.y += gl->advance.y >> 10;
|
{
|
||||||
|
ftdelta.x += gl->advance.x >> 10;
|
||||||
|
ftdelta.y += gl->advance.y >> 10;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (delta_flags & 0x1)
|
||||||
|
ftdelta.x += delta_data[d++] * 64.0;
|
||||||
|
if (delta_flags & 0x2)
|
||||||
|
ftdelta.y += delta_data[d++] * 64.0;
|
||||||
|
if (delta_flags & 0x4)
|
||||||
|
{
|
||||||
|
ftdelta.x += (gl->advance.x >> 10) + delta_data[0] * 64.0;
|
||||||
|
ftdelta.y += (gl->advance.y >> 10) + delta_data[1] * 64.0;
|
||||||
|
if ((delta_flags & 0x8) && (uch == wch))
|
||||||
|
{
|
||||||
|
ftdelta.x += delta_data[2] * 64.0;
|
||||||
|
ftdelta.y += delta_data[3] * 64.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (delta_flags & 0x8)
|
||||||
|
{
|
||||||
|
if (uch == wch)
|
||||||
|
{
|
||||||
|
ftdelta.x += (gl->advance.x >> 10) + delta_data[0] * 64.0;
|
||||||
|
ftdelta.y += (gl->advance.y >> 10) + delta_data[1] * 64.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ftdelta.x += gl->advance.x >> 10;
|
||||||
|
ftdelta.y += gl->advance.y >> 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FT_Done_Glyph(gl);
|
FT_Done_Glyph(gl);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue