* Source/NSLayoutManager.m:

* Source/NSGraphicsContext.m:
* Headers/AppKit/DPSOperators.h:
* Headers/AppKit/NSGraphicsContext.h:
* Headers/Additions/GNUstepGUI/GSMethodTable.h:
New GSShowGlyphsWithAdvances, which replaces
GSShowGlyphs as the primitive text drawing method.
(used by -[NSLayoutManager drawGlyphsForGlyphRange:atPoint:])

Requires r33121 in -back.

Note that the advances aren't actually used by -back yet so
text output should be unchanged.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33122 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2011-05-26 03:55:55 +00:00
parent 07ee1e9f6c
commit 5f73c3f623
6 changed files with 49 additions and 6 deletions

View file

@ -1487,6 +1487,7 @@ attachmentSize(linefrag_t *lf, NSUInteger glyphIndex)
#define GBUF_SIZE 16 /* TODO: tweak */
NSGlyph gbuf[GBUF_SIZE];
NSSize advancementbuf[GBUF_SIZE];
int gbuf_len, gbuf_size;
NSPoint gbuf_point = NSZeroPoint;
@ -1579,7 +1580,7 @@ attachmentSize(linefrag_t *lf, NSUInteger glyphIndex)
if (gbuf_len)
{
DPSmoveto(ctxt, gbuf_point.x, gbuf_point.y);
GSShowGlyphs(ctxt, gbuf, gbuf_len);
GSShowGlyphsWithAdvances(ctxt, gbuf, advancementbuf, gbuf_len);
DPSnewpath(ctxt);
gbuf_len = 0;
}
@ -1608,7 +1609,7 @@ attachmentSize(linefrag_t *lf, NSUInteger glyphIndex)
if (gbuf_len)
{
DPSmoveto(ctxt, gbuf_point.x, gbuf_point.y);
GSShowGlyphs(ctxt, gbuf, gbuf_len);
GSShowGlyphsWithAdvances(ctxt, gbuf, advancementbuf, gbuf_len);
DPSnewpath(ctxt);
gbuf_len = 0;
}
@ -1649,7 +1650,7 @@ attachmentSize(linefrag_t *lf, NSUInteger glyphIndex)
if (gbuf_len)
{
DPSmoveto(ctxt, gbuf_point.x, gbuf_point.y);
GSShowGlyphs(ctxt, gbuf, gbuf_len);
GSShowGlyphsWithAdvances(ctxt, gbuf, advancementbuf, gbuf_len);
DPSnewpath(ctxt);
gbuf_len = 0;
}
@ -1720,12 +1721,14 @@ attachmentSize(linefrag_t *lf, NSUInteger glyphIndex)
if (gbuf_len == gbuf_size)
{
DPSmoveto(ctxt, gbuf_point.x, gbuf_point.y);
GSShowGlyphs(ctxt, gbuf, gbuf_size);
GSShowGlyphsWithAdvances(ctxt, gbuf, advancementbuf, gbuf_size);
DPSnewpath(ctxt);
gbuf_len = 0;
gbuf_point = p;
}
gbuf[gbuf_len++] = glyph->g;
gbuf[gbuf_len] = glyph->g;
advancementbuf[gbuf_len] = [f advancementForGlyph: glyph->g];
gbuf_len++;
}
}
p.x += [f advancementForGlyph: glyph->g].width;
@ -1737,7 +1740,7 @@ attachmentSize(linefrag_t *lf, NSUInteger glyphIndex)
printf("%i at (%g %g) 4\n", gbuf_len, gbuf_point.x, gbuf_point.y);
for (i = 0; i < gbuf_len; i++) printf(" %3i : %04x\n", i, gbuf[i]); */
DPSmoveto(ctxt, gbuf_point.x, gbuf_point.y);
GSShowGlyphs(ctxt, gbuf, gbuf_len);
GSShowGlyphsWithAdvances(ctxt, gbuf, advancementbuf, gbuf_len);
DPSnewpath(ctxt);
}