Skip to content

Commit 107cbfc

Browse files
author
Oskari Leppäaho
committed
Fix the too big font on iOS
1 parent dfde658 commit 107cbfc

2 files changed

Lines changed: 1 addition & 10 deletions

File tree

release/NativeEditPlugin/Plugins/iOS/EditBox_iOS.m

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,10 +323,7 @@ -(void) create:(JsonObject*)json
323323
returnKeyType = UIReturnKeyDone;
324324
}
325325

326-
CGRect screenRect = [[UIScreen mainScreen] bounds];
327-
CGFloat screenWidth = screenRect.size.width;
328-
CGFloat logicalScreenWidth = screenWidth / viewPlugin.contentScaleFactor;
329-
fontSize = (logicalScreenWidth / 1024.0f) * fontSize;
326+
fontSize = fontSize / viewPlugin.contentScaleFactor;
330327

331328
UIFont* uiFont;
332329
if ([font length] > 0)

release/NativeEditPlugin/scripts/NativeEditBox.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,9 @@ private void PrepareNativeEdit()
209209
if (useInputFieldFont)
210210
mConfig.font = objUnityText.font.fontNames.Length > 0 ? objUnityText.font.fontNames[0] : "Arial";
211211

212-
213-
// Font size scaling for iOS is done on the native side.
214-
#if UNITY_IOS
215-
mConfig.fontSize = ((float)objUnityText.fontSize);
216-
#else
217212
Rect rectScreen = GetScreenRectFromRectTransform(this.objUnityText.rectTransform);
218213
float fHeightRatio = rectScreen.height / objUnityText.rectTransform.rect.height;
219214
mConfig.fontSize = ((float) objUnityText.fontSize) * fHeightRatio;
220-
#endif
221215

222216
mConfig.textColor = objUnityText.color;
223217
mConfig.align = objUnityText.alignment.ToString();

0 commit comments

Comments
 (0)