From 89f4a1208bdcb3ecdf1be093e5cc3996974c603d Mon Sep 17 00:00:00 2001 From: Sergey Date: Mon, 14 Dec 2015 18:55:21 +0300 Subject: [PATCH] fix font for EditBox in iOS & Mac --- cocos/ui/UIEditBox/UIEditBoxImpl-ios.mm | 2 ++ cocos/ui/UIEditBox/UIEditBoxImpl-mac.mm | 1 + 2 files changed, 3 insertions(+) diff --git a/cocos/ui/UIEditBox/UIEditBoxImpl-ios.mm b/cocos/ui/UIEditBox/UIEditBoxImpl-ios.mm index 8579fe8b76..30ace4579f 100644 --- a/cocos/ui/UIEditBox/UIEditBoxImpl-ios.mm +++ b/cocos/ui/UIEditBox/UIEditBoxImpl-ios.mm @@ -207,6 +207,8 @@ UIFont* EditBoxImplIOS::constructFont(const char *fontName, int fontSize) float retinaFactor = eaglview.contentScaleFactor; NSString * fntName = [NSString stringWithUTF8String:fontName]; + fntName = [[fntName lastPathComponent] stringByDeletingPathExtension]; + auto glview = cocos2d::Director::getInstance()->getOpenGLView(); float scaleFactor = glview->getScaleX(); diff --git a/cocos/ui/UIEditBox/UIEditBoxImpl-mac.mm b/cocos/ui/UIEditBox/UIEditBoxImpl-mac.mm index b5afaadf98..87d07afd6e 100644 --- a/cocos/ui/UIEditBox/UIEditBoxImpl-mac.mm +++ b/cocos/ui/UIEditBox/UIEditBoxImpl-mac.mm @@ -377,6 +377,7 @@ bool EditBoxImplMac::initWithSize(const Size& size) NSFont* EditBoxImplMac::constructFont(const char *fontName, int fontSize) { NSString * fntName = [NSString stringWithUTF8String:fontName]; + fntName = [[fntName lastPathComponent] stringByDeletingPathExtension]; float retinaFactor = _inRetinaMode ? 2.0f : 1.0f; auto glview = cocos2d::Director::getInstance()->getOpenGLView(); float scaleFactor = glview->getScaleX();