implement more font info

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@24445 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2007-01-31 17:15:27 +00:00
parent 00622e1e14
commit 515819931b
5 changed files with 76 additions and 5 deletions

View file

@ -1,3 +1,11 @@
2007-01-31 Richard Frith-Macdonald <rfm@gnu.org>
* Source\winlib\WIN32FontInfo.m:
* Source\winlib\GNUmakefile.preamble:
* Source\win32\GNUmakefile.preamble:
* Headers\winlib\WIN32FontInfo.h:
Implement number of glyphs and covered characterset.
2007-01-31 Richard Frith-Macdonald <rfm@gnu.org>
* Source/art/ftfont.m: Implement methods to get count of characters

View file

@ -19,7 +19,8 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#ifndef _WIN32FontInfo_h_INCLUDE

View file

@ -31,10 +31,10 @@ GNUSTEP_INSTALL_LIBDIR=$(GNUSTEP_LIBRARIES_ROOT)
ADDITIONAL_CPPFLAGS += -Wall $(CONFIG_SYSTEM_DEFS)
# Additional flags to pass to the Objective-C compiler
ADDITIONAL_OBJCFLAGS =
ADDITIONAL_OBJCFLAGS = -DWINVER=0x0500
# Additional flags to pass to the C compiler
ADDITIONAL_CFLAGS =
ADDITIONAL_CFLAGS = -DWINVER=0x0500
# Additional include directories the compiler should search
ADDITIONAL_INCLUDE_DIRS += -I../../Headers \

View file

@ -40,10 +40,10 @@ GNUSTEP_INSTALL_LIBDIR=$(GNUSTEP_LIBRARIES_ROOT)
ADDITIONAL_CPPFLAGS += -Wall $(CONFIG_SYSTEM_DEFS)
# Additional flags to pass to the Objective-C compiler
#ADDITIONAL_OBJCFLAGS =
ADDITIONAL_OBJCFLAGS = -DWINVER=0x0500
# Additional flags to pass to the C compiler
#ADDITIONAL_CFLAGS =
ADDITIONAL_CFLAGS = -DWINVER=0x0500
# Additional include directories the compiler should search
ADDITIONAL_INCLUDE_DIRS = -I../../Headers \

View file

@ -24,6 +24,7 @@
*/
#include <Foundation/NSCharacterSet.h>
#include <Foundation/NSDictionary.h>
#include <Foundation/NSString.h>
#include <Foundation/NSArray.h>
@ -160,6 +161,58 @@ NSString *win32_font_family(NSString *fontName);
return NSMakePoint(0, 0);
}
- (NSCharacterSet*) coveredCharacterSet
{
if (coveredCharacterSet == nil)
{
NSMutableCharacterSet *ms;
unsigned count;
GLYPHSET *gs = 0;
HDC hdc;
HFONT old;
hdc = GetDC(NULL);
old = SelectObject(hdc, hFont);
count = (unsigned)GetFontUnicodeRanges(hdc, 0);
if (count > 0)
{
gs = (GLYPHSET*)objc_malloc(count);
if ((unsigned)GetFontUnicodeRanges(hdc, gs) == count)
{
numberOfGlyphs = gs->cGlyphsSupported;
if (gs->flAccel == 1 /* GS_8BIT_INDICES */)
{
for (count = 0; count < gs->cRanges; count++)
{
NSRange range;
range.location = gs->ranges[count].wcLow & 0xff;
range.length = gs->ranges[count].cGlyphs;
[ms addCharactersInRange: range];
}
}
else
{
for (count = 0; count < gs->cRanges; count++)
{
NSRange range;
range.location = gs->ranges[count].wcLow;
range.length = gs->ranges[count].cGlyphs;
[ms addCharactersInRange: range];
}
}
}
objc_free(gs);
}
SelectObject(hdc, old);
ReleaseDC(NULL, hdc);
coveredCharacterSet = [ms copy];
RELEASE(ms);
}
return coveredCharacterSet;
}
- (void) drawString: (NSString*)string
onDC: (HDC)hdc
at: (POINT)p
@ -207,6 +260,15 @@ NSString *win32_font_family(NSString *fontName);
SelectObject(hdc, old);
}
- (unsigned) numberOfglyphs
{
if (coveredCharacterSet == nil)
{
[self coveredCharacterSet];
}
return numberOfGlyphs;
}
@end
@implementation WIN32FontInfo (Private)