mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-23 11:51:27 +00:00
fix error calculating advancementwq
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@24490 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
99845a94d9
commit
c8c8adec8f
2 changed files with 9 additions and 12 deletions
|
@ -1,3 +1,8 @@
|
|||
2007-02-08 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/winlib/WIN32FontInfo.m:
|
||||
Fix error calculating advancement.
|
||||
|
||||
2007-01-31 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source\winlib\WIN32FontInfo.m:
|
||||
|
|
|
@ -99,8 +99,7 @@ NSString *win32_font_family(NSString *fontName);
|
|||
|
||||
- (NSSize) advancementForGlyph: (NSGlyph)glyph
|
||||
{
|
||||
WORD c = (WORD)glyph;
|
||||
WORD windowsGlyph;
|
||||
unichar u = (unichar)glyph;
|
||||
HDC hdc;
|
||||
float w;
|
||||
ABCFLOAT abc;
|
||||
|
@ -108,15 +107,8 @@ NSString *win32_font_family(NSString *fontName);
|
|||
|
||||
hdc = GetDC(NULL);
|
||||
old = SelectObject(hdc, hFont);
|
||||
// Convert from GNUstep glyph (unichar) to windows glyph.
|
||||
if (GetGlyphIndicesW(hdc, &c, 1, &windowsGlyph, 0) == 0)
|
||||
{
|
||||
SelectObject(hdc, old);
|
||||
ReleaseDC(NULL, hdc);
|
||||
NSLog(@"No glyph for U%d", c);
|
||||
return NSMakeSize(0, 0); // No such glyph
|
||||
}
|
||||
GetCharABCWidthsFloatW(hdc, windowsGlyph, windowsGlyph, &abc);
|
||||
// FIXME ... currently a gnustep glyph is a unichar ... what if that changes.
|
||||
GetCharABCWidthsFloatW(hdc, u, u, &abc);
|
||||
SelectObject(hdc, old);
|
||||
ReleaseDC(NULL, hdc);
|
||||
|
||||
|
@ -137,7 +129,7 @@ NSLog(@"No glyph for U%d", c);
|
|||
hdc = GetDC(NULL);
|
||||
old = SelectObject(hdc, hFont);
|
||||
// Convert from GNUstep glyph (unichar) to windows glyph.
|
||||
if (GetGlyphIndicesW(hdc, &c, 1, &windowsGlyph, 0) == 0)
|
||||
if (GetGlyphIndicesW(hdc, &c, 1, &windowsGlyph, 0) == GDI_ERROR)
|
||||
{
|
||||
SelectObject(hdc, old);
|
||||
ReleaseDC(NULL, hdc);
|
||||
|
|
Loading…
Reference in a new issue