File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99NSMutableDictionary * dictEditBox = nil ;
1010EditBoxHoldView* viewPlugin = nil ;
1111
12- #define DEF_PixelPerPoint 2 .2639f // 72 points per inch. iPhone 163DPI
1312char g_unityName[64 ];
1413
1514bool approxEqualFloat (float x, float y)
@@ -297,8 +296,6 @@ -(void) create:(JsonObject*)json
297296 valign = UIControlContentVerticalAlignmentBottom;
298297 halign = UIControlContentHorizontalAlignmentRight;
299298 }
300-
301- fontSize = fontSize / DEF_PixelPerPoint;
302299
303300 if (withDoneButton)
304301 {
@@ -328,9 +325,17 @@ -(void) create:(JsonObject*)json
328325
329326 UIFont* uiFont;
330327 if ([font length ] > 0 )
328+ {
331329 uiFont = [UIFont fontWithName: font size: fontSize];
330+ NSLog (@" Font lenth more than 0" );
331+ }
332332 else
333+ {
333334 uiFont = [UIFont systemFontOfSize: fontSize];
335+ NSLog (@" Font length less than 0" );
336+ }
337+
338+ NSLog ([NSString stringWithFormat: @" %@ /%f " , @" font size" , fontSize]);
334339
335340 if (multiline)
336341 {
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ void Start () {
1818 tempTest . transform . position += new Vector3 ( 0.0f , - 250.0f , 0.0f ) ;
1919
2020 NativeEditBox tempNB = tempTest . GetComponent < NativeEditBox > ( ) ; ;
21- tempNB . SetTextNative ( "fdfdsfsd" ) ;
21+ // tempNB.SetTextNative("fdfdsfsd");
2222 }
2323
2424 // Update is called once per frame
@@ -57,7 +57,7 @@ public void OnButton1()
5757 {
5858 bTempFocus = ! bTempFocus ;
5959 Debug . Log ( "OnButton1 clicked" ) ;
60- testNativeEdit . SetFocusNative ( bTempFocus ) ;
60+ // testNativeEdit.SetFocusNative(bTempFocus);
6161 }
6262
6363 public void OnButton2 ( )
@@ -77,7 +77,7 @@ public void OnButton3()
7777 public void OnButton5 ( )
7878 {
7979 Debug . Log ( "OnButton5 clicked" ) ;
80- testNativeEdit . SetTextNative ( "TestText Set!!@#@5" ) ;
80+ // testNativeEdit.SetTextNative("TestText Set!!@#@5");
8181 }
8282
8383
Original file line number Diff line number Diff line change @@ -203,7 +203,14 @@ private void PrepareNativeEdit()
203203
204204 Rect rectScreen = GetScreenRectFromRectTransform ( this . objUnityText . rectTransform ) ;
205205 float fHeightRatio = rectScreen . height / objUnityText . rectTransform . rect . height ;
206- mConfig . fontSize = ( ( float ) objUnityText . fontSize ) * fHeightRatio ;
206+
207+ var screenSizeInches = ( float ) Screen . height / ( float ) Screen . dpi ;
208+ var screenAspectRatio = ( float ) Screen . width / ( float ) Screen . height ;
209+
210+
211+ UnityEngine . Debug . Log ( "screen width: " + Screen . width + " Screen height: " + Screen . height + "screenAspectRatio: " + screenAspectRatio + " unity font size: " + objUnityText . fontSize + " screensizeinches: " + screenSizeInches ) ;
212+
213+ mConfig . fontSize = ( ( float ) objUnityText . fontSize ) * screenSizeInches * 0.23f * screenAspectRatio / 1.779f ;
207214
208215 mConfig . textColor = objUnityText . color ;
209216 mConfig . align = objUnityText . alignment . ToString ( ) ;
You can’t perform that action at this time.
0 commit comments