Pmovil / CN1WindowsPort

Windows RT port to Codename One
MIT License
6 stars 3 forks source link

Fix draw circle,totalMemory,backkey; GPS; dispatcher using #8

Closed PiotrZub closed 8 years ago

PiotrZub commented 8 years ago
FabioConceicao commented 8 years ago

Thanks @PiotrZub , we've just merged everything. There is only one thing where we don't agree, the unmodified font size is actually pretty close to other platforms when compared side by side, did you do this same comparison ? We will probably revert this size change, just compare it with other ports and let us know what you think.

PiotrZub commented 8 years ago

To be honest I do not finish font size correction because when I change font size line margins are changing too. When I use default font size (20p) it is ok on WVGA (800x600) phone but too small on WXGA/720p/1080p. It look like Win2D do not care about scaling it like other graphics elements (ex. line spacing)? See Screenshots: 480_800 https://drive.google.com/file/d/0B_J2xdfDrOC8SzNPNk1lLTcwZUk/view?usp=sharing 720_1280 https://drive.google.com/file/d/0B_J2xdfDrOC8SlFXdDhYM05KZk0/view?usp=sharing

FabricioCabeca commented 8 years ago

If you use a default font size in points it won't scale, you may try defining the font size in millimeters and compare with the default Win2D "reasonable guess"

btw, good to know you have a 720x1280 test device as we don't have one here ;)

PiotrZub commented 8 years ago

Yes I use Lumia 730 (720x1280 4.7" 312ppi).

Ok. You suggest defining the font size in millimetres in CN1 Theme? How I know to do that we need our own true type font? CN1WindowsPort support true type font?

I will try but I think if it is possibly default font should look ok on most devices, so maybe we must defined default font in millimeters in your port?

FabricioCabeca commented 8 years ago

Yes ! We do support true type fonts :-)

As the default base font size from Win2D looks good in our test devices we didn't dig this further, using millimeters as a default may be an option.

I will try to get another Windows device to test these fonts further and see if there should be a better default, but you can define a true type font size in millimeters in your style for sure.

PiotrZub commented 8 years ago

Yes I can define size of true crypt fonts but I need to provide the font I can't use system fonts in this case.

To test other resolution you do not need special devide, you can use emulator.

FabioConceicao commented 8 years ago

We are working so that we have a position providing ok

FabioConceicao commented 8 years ago

SilverlightImplementation we will be out until 23 on Monday u could see how to port those changes in CreateFont int a = Convert.ToInt32(nf.font.FontSize * (float)scaleFactor); if (scaleFactor == 1.2f) a = (int)nf.font.FontSize; switch (size) { case 8: //com.codename1.ui.Font._fSIZE_1SMALL: a = Convert.ToInt32(nf.font.FontSize * (float)1.8 / 3 * (float)scaleFactor); break; case 16: //com.codename1.ui.Font._fSIZE_1LARGE: a = Convert.ToInt32(nf.font.FontSize * (float)3.5 / 3 * (float)scaleFactor); break; } nf.font.FontSize = a;

PiotrZub commented 8 years ago

Yes it look much better: https://drive.google.com/file/d/0B_J2xdfDrOC8b21XdV9sUG5TNTA/view?usp=sharing https://drive.google.com/file/d/0B_J2xdfDrOC8dVpxVDhSbFhYWUk/view?usp=sharing but still there is problem with line spacing. Line is to high - double scaled? - and asymmetric. Any idea why?

FabricioCabeca commented 8 years ago

We may try to play with LineSpacingBaseline, it uses a "reasonable default" of 80%, but things are not so reasonable I guess ... See https://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Text_CanvasTextLayout.htm

PiotrZub commented 8 years ago

Fabricio, there is much simpler way, just we need remove scaling from line: actualHeight = Convert.ToInt32(Math.Ceiling(fontLayout.LayoutBounds.Height)); // * SilverlightImplementation.scaleFactor)); ///FA Test Now line spacing is ok.