2013-06-25 17:13:37 +00:00
|
|
|
/*
|
|
|
|
OpalFontInfo.m
|
|
|
|
|
|
|
|
Copyright (C) 2013 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
Author: Ivan Vucica <ivan@vucica.net>
|
|
|
|
Date: June 2013
|
|
|
|
|
|
|
|
This file is part of GNUstep.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with this library; see the file COPYING.LIB.
|
|
|
|
If not, see <http://www.gnu.org/licenses/> or write to the
|
|
|
|
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
2013-07-23 23:18:48 +00:00
|
|
|
#import <Foundation/Foundation.h>
|
2013-06-25 17:13:37 +00:00
|
|
|
#import "opal/OpalFontInfo.h"
|
|
|
|
|
|
|
|
@implementation OpalFontInfo
|
|
|
|
|
|
|
|
- (id) initWithFontName: (NSString *)name
|
|
|
|
matrix: (const CGFloat *)fmatrix
|
|
|
|
screenFont: (BOOL)p_screenFont
|
|
|
|
{
|
2013-07-23 23:18:48 +00:00
|
|
|
NSDebugLLog(@"OpalFontInfo", @"OpalFontInfo: instantiating font info for %@", name);
|
2013-06-25 17:13:37 +00:00
|
|
|
return [super init];
|
|
|
|
}
|
2013-07-15 15:24:04 +00:00
|
|
|
- (NSRect) boundingRectForGlyph: (NSGlyph)glyph
|
|
|
|
{
|
2013-07-23 23:18:48 +00:00
|
|
|
NSDebugLLog(@"OpalFontInfo", @"OpalFontInfo: %s - %c", __PRETTY_FUNCTION__, glyph);
|
2013-07-15 15:24:04 +00:00
|
|
|
return NSMakeRect(0, 0, 10, 10);
|
|
|
|
}
|
|
|
|
- (CGFloat) widthOfString: (NSString *)string
|
|
|
|
{
|
2013-07-23 23:18:48 +00:00
|
|
|
NSDebugLLog(@"OpalFontInfo", @"OpalFontInfo: %s - %@", __PRETTY_FUNCTION__, string);
|
2013-07-15 15:24:04 +00:00
|
|
|
return [string length] * 10;
|
|
|
|
}
|
2013-07-21 11:58:05 +00:00
|
|
|
- (NSSize) advancementForGlyph: (NSGlyph)glyph
|
|
|
|
{
|
2013-07-23 23:18:48 +00:00
|
|
|
NSDebugLLog(@"OpalFontInfo", @"OpalFontInfo: %s - %c", __PRETTY_FUNCTION__, glyph);
|
2013-07-21 11:58:05 +00:00
|
|
|
return NSMakeSize(100,100);
|
|
|
|
}
|
|
|
|
- (NSGlyph) glyphWithName: (NSString *) glyphName
|
|
|
|
{
|
2013-07-23 23:18:48 +00:00
|
|
|
NSDebugLLog(@"OpalFontInfo", @"OpalFontInfo: %s - %@", __PRETTY_FUNCTION__, glyphName);
|
2013-07-21 11:58:05 +00:00
|
|
|
|
|
|
|
// FIXME: incorrect
|
|
|
|
NSGlyph g = [glyphName cString][0];
|
|
|
|
return g;
|
|
|
|
}
|
|
|
|
- (NSGlyph) glyphForCharacter: (unichar)c
|
|
|
|
{
|
|
|
|
// FIXME: default in 'gui' uses -glyphIsEncoded: or otherwise
|
|
|
|
// returns null glyph. the default should be sufficient, and is
|
|
|
|
// sufficient for cairo backend.
|
|
|
|
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
- (void) appendBezierPathWithGlyphs: (NSGlyph *)glyphs
|
|
|
|
count: (int)length
|
|
|
|
toBezierPath: (NSBezierPath *)path
|
|
|
|
{
|
|
|
|
[path lineToPoint: NSMakePoint(length*10, 10)];
|
|
|
|
}
|
2013-06-25 17:13:37 +00:00
|
|
|
@end
|