fix font for EditBox in iOS & Mac

This commit is contained in:
Sergey 2015-12-14 18:55:21 +03:00
parent 3dbc453ee2
commit 89f4a1208b
2 changed files with 3 additions and 0 deletions

View File

@ -207,6 +207,8 @@ UIFont* EditBoxImplIOS::constructFont(const char *fontName, int fontSize)
float retinaFactor = eaglview.contentScaleFactor; float retinaFactor = eaglview.contentScaleFactor;
NSString * fntName = [NSString stringWithUTF8String:fontName]; NSString * fntName = [NSString stringWithUTF8String:fontName];
fntName = [[fntName lastPathComponent] stringByDeletingPathExtension];
auto glview = cocos2d::Director::getInstance()->getOpenGLView(); auto glview = cocos2d::Director::getInstance()->getOpenGLView();
float scaleFactor = glview->getScaleX(); float scaleFactor = glview->getScaleX();

View File

@ -377,6 +377,7 @@ bool EditBoxImplMac::initWithSize(const Size& size)
NSFont* EditBoxImplMac::constructFont(const char *fontName, int fontSize) NSFont* EditBoxImplMac::constructFont(const char *fontName, int fontSize)
{ {
NSString * fntName = [NSString stringWithUTF8String:fontName]; NSString * fntName = [NSString stringWithUTF8String:fontName];
fntName = [[fntName lastPathComponent] stringByDeletingPathExtension];
float retinaFactor = _inRetinaMode ? 2.0f : 1.0f; float retinaFactor = _inRetinaMode ? 2.0f : 1.0f;
auto glview = cocos2d::Director::getInstance()->getOpenGLView(); auto glview = cocos2d::Director::getInstance()->getOpenGLView();
float scaleFactor = glview->getScaleX(); float scaleFactor = glview->getScaleX();