mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-14 06:50:29 +02:00
Initial attempt at loading Roboto into CoreText
This commit is contained in:
1 parent
841eb115e2
commit
a04c2d1a6a
1 file changed
+10
-3
@@ -32,7 +32,12 @@ enum {
|
||||
MAX_TEXT_HEIGHT = 512
|
||||
};
|
||||
|
||||
#define APPLE_FONT "Helvetica"
|
||||
#define APPLE_FONT "Roboto-Condensed"
|
||||
|
||||
// for future OpenEmu support
|
||||
#ifndef PPSSPP_FONT_BUNDLE
|
||||
#define PPSSPP_FONT_BUNDLE [NSBundle mainBundle]
|
||||
#endif
|
||||
|
||||
class TextDrawerFontContext {
|
||||
public:
|
||||
@@ -44,8 +49,10 @@ public:
|
||||
// Create an attributed string with string and font information
|
||||
CGFloat fontSize = ceilf((height / dpiScale) * 1.25f);
|
||||
INFO_LOG(Log::G3D, "Creating cocoa typeface '%s' size %d (effective size %0.1f)", APPLE_FONT, height, fontSize);
|
||||
// CTFontRef font = CTFontCreateWithName(CFSTR(APPLE_FONT), fontSize, nil);
|
||||
CTFontRef font = CTFontCreateUIFontForLanguage(kCTFontUIFontSystem, fontSize, nil);
|
||||
NSURL *fontURL = [PPSSPP_FONT_BUNDLE URLForResource:@"Roboto-Condensed" withExtension:@"ttf" subdirectory:@"assets"];
|
||||
CTFontManagerRegisterFontsForURL((CFURLRef)fontURL, kCTFontManagerScopeProcess, NULL);
|
||||
CTFontRef font = CTFontCreateWithName(CFSTR(APPLE_FONT), fontSize, nil);
|
||||
// CTFontRef font = CTFontCreateUIFontForLanguage(kCTFontUIFontSystem, fontSize, nil);
|
||||
attributes = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
(__bridge id)font, kCTFontAttributeName,
|
||||
kCFBooleanTrue, kCTForegroundColorFromContextAttributeName, // Lets us specify the color later.
|
||||
|
||||
Reference in new issue
Block a user