mirror of
https://github.com/gnustep/libs-back.git
synced 2025-04-22 23:42:16 +00:00
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:
parent
b11db22054
commit
df830a647f
5 changed files with 76 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue