Forward most glayph layout methods to font info

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@6660 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2000-06-11 00:31:50 +00:00
parent 677a7211fa
commit 946886656d

View file

@ -45,6 +45,9 @@
Convention (see the red book).*/
static NSMutableSet* fontsUsed = nil;
/* Fonts that are preferred by the application */
NSArray *_preferredFonts;
NSFont*
getNSFont(NSString* key, NSString* defaultFontName, float fontSize)
{
@ -114,6 +117,11 @@ setNSFont(NSString* key, NSFont* font)
return getNSFont (@"NSUserFont", @"Helvetica", fontSize);
}
+ (NSArray *)preferredFontNames
{
return _preferredFonts;
}
/* Setting the preferred user fonts*/
+ (void) setUserFixedPitchFont: (NSFont*)font
@ -126,6 +134,11 @@ setNSFont(NSString* key, NSFont* font)
setNSFont (@"NSUserFont", font);
}
+ (void)setPreferredFontNames:(NSArray *)fontNames
{
ASSIGN(_preferredFonts, fontNames);
}
/* Getting various fonts*/
#ifndef STRICT_OPENSTEP
@ -291,6 +304,7 @@ setNSFont(NSString* key, NSFont* font)
- (float) underlinePosition { return [fontInfo underlinePosition]; }
- (float) underlineThickness { return [fontInfo underlineThickness]; }
- (float) xHeight { return [fontInfo xHeight]; }
- (float) defaultLineHeightForFont { return [fontInfo defaultLineHeightForFont]; }
/* Computing font metrics attributes*/
- (float) widthOfString: (NSString*)string
@ -323,6 +337,11 @@ setNSFont(NSString* key, NSFont* font)
return [fontInfo glyphIsEncoded: aGlyph ];
}
- (NSMultibyteGlyphPacking)glyphPacking
{
return [fontInfo glyphPacking];
}
- (NSGlyph) glyphWithName: (NSString*)glyphName
{
return [fontInfo glyphWithName: glyphName ];
@ -336,6 +355,75 @@ setNSFont(NSString* key, NSFont* font)
isNominal: nominal];
}
- (NSPoint)positionOfGlyph:(NSGlyph)aGlyph
forCharacter:(unichar)aChar
struckOverRect:(NSRect)aRect
{
return [fontInfo positionOfGlyph: aGlyph
forCharacter: aChar
struckOverRect: aRect];
}
- (NSPoint)positionOfGlyph:(NSGlyph)aGlyph
struckOverGlyph:(NSGlyph)baseGlyph
metricsExist:(BOOL *)flag
{
return [fontInfo positionOfGlyph: aGlyph
struckOverGlyph: baseGlyph
metricsExist: flag];
}
- (NSPoint)positionOfGlyph:(NSGlyph)aGlyph
struckOverRect:(NSRect)aRect
metricsExist:(BOOL *)flag
{
return [fontInfo positionOfGlyph: aGlyph
struckOverRect: aRect
metricsExist: flag];
}
- (NSPoint)positionOfGlyph:(NSGlyph)aGlyph
withRelation:(NSGlyphRelation)relation
toBaseGlyph:(NSGlyph)baseGlyph
totalAdvancement:(NSSize *)offset
metricsExist:(BOOL *)flag
{
return [fontInfo positionOfGlyph: aGlyph
withRelation: relation
toBaseGlyph: baseGlyph
totalAdvancement: offset
metricsExist: flag];
}
- (int)positionsForCompositeSequence:(NSGlyph *)glyphs
numberOfGlyphs:(int)numGlyphs
pointArray:(NSPoint *)points
{
int i;
NSGlyph base = glyphs[0];
points[0] = NSZeroPoint;
for (i = 1; i < numGlyphs; i++)
{
BOOL flag;
// This only places the glyphs relative to the base glyph
// not to each other
points[i] = [self positionOfGlyph: glyphs[i]
struckOverGlyph: base
metricsExist: &flag];
if (!flag)
return i - 1;
}
return i;
}
- (NSStringEncoding)mostCompatibleStringEncoding
{
return [fontInfo mostCompatibleStringEncoding];
}
//
// NSCoding protocol
//