mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 02:10:48 +00:00
* 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:
parent
07ee1e9f6c
commit
5f73c3f623
6 changed files with 49 additions and 6 deletions
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
|||
2011-05-25 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* 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.
|
||||
|
||||
2011-05-25 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/NSComboBoxCell.m: Correct positioning of popup window when
|
||||
|
|
|
@ -112,6 +112,8 @@ typedef struct {
|
|||
(NSGraphicsContext*, SEL, const char *, size_t);
|
||||
void (*GSShowGlyphs__)
|
||||
(NSGraphicsContext*, SEL, const NSGlyph *, size_t);
|
||||
void (*GSShowGlyphsWithAdvances__)
|
||||
(NSGraphicsContext*, SEL, const NSGlyph *, const NSSize *, size_t);
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* Gstate Handling */
|
||||
|
|
|
@ -169,6 +169,11 @@ static inline void
|
|||
GSShowGlyphs(GSCTXT *ctxt, const NSGlyph * glyphs, size_t length)
|
||||
__attribute__((unused));
|
||||
|
||||
static inline void
|
||||
GSShowGlyphsWithAdvances(GSCTXT *ctxt, const NSGlyph * glyphs, const NSSize * advances, size_t length)
|
||||
__attribute__((unused));
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* Gstate Handling */
|
||||
|
@ -700,6 +705,13 @@ GSShowGlyphs(GSCTXT *ctxt, const NSGlyph * glyphs, size_t length)
|
|||
(ctxt, @selector(GSShowGlyphs: :), glyphs, length);
|
||||
}
|
||||
|
||||
static inline void
|
||||
GSShowGlyphsWithAdvances(GSCTXT *ctxt, const NSGlyph * glyphs, const NSSize * advances, size_t length)
|
||||
{
|
||||
(ctxt->methods->GSShowGlyphsWithAdvances__)
|
||||
(ctxt, @selector(GSShowGlyphsWithAdvances: :), glyphs, advances, length);
|
||||
}
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* Gstate Handling */
|
||||
|
|
|
@ -307,6 +307,7 @@ APPKIT_EXPORT NSGraphicsContext *GSCurrentContext(void);
|
|||
- (void) GSSetTextPosition: (NSPoint)loc;
|
||||
- (void) GSShowText: (const char *)string : (size_t) length;
|
||||
- (void) GSShowGlyphs: (const NSGlyph *)glyphs : (size_t) length;
|
||||
- (void) GSShowGlyphsWithAdvances: (const NSGlyph *)glyphs : (const NSSize *)advances : (size_t) length;
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* Gstate Handling */
|
||||
|
|
|
@ -561,6 +561,8 @@ NSGraphicsContext *GSCurrentContext(void)
|
|||
GET_IMP(@selector(GSShowText::));
|
||||
methodTable.GSShowGlyphs__ =
|
||||
GET_IMP(@selector(GSShowGlyphs::));
|
||||
methodTable.GSShowGlyphsWithAdvances__ =
|
||||
GET_IMP(@selector(GSShowGlyphsWithAdvances:::));
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* Gstate Handling */
|
||||
|
@ -1078,6 +1080,13 @@ NSGraphicsContext *GSCurrentContext(void)
|
|||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
/** Paints the glyphs with the specified advances using the current font.
|
||||
(Quartz). */
|
||||
- (void) GSShowGlyphsWithAdvances: (const NSGlyph *)glyphs : (const NSSize *)advances : (size_t) length
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* Gstate Handling */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue