lc-soft / LCUI

C library for building user interfaces
https://lcui-dev.github.io
MIT License
4.15k stars 357 forks source link

Inconsistent font rendering/sizing #135

Closed coderobe closed 6 years ago

coderobe commented 6 years ago

The LCUI example helloworld shows inconsistent font sizes when updating the text.

Reproduction Steps:

  1. Build current develop branch
  2. Build examples in test/
  3. Run the built helloworld
  4. Repeatedly click the Change button

Screenshots and GIFs font-rendering

LCUI version: branch develop commit 402bc031b424923b89feea390a84a2c15a9b1fdb OS and version: Linux 4.15.1 Build tools: gcc (GCC) 7.3.0 Libraries (taken from LCUI_LIBS in the generated Makefile):

lc-soft commented 6 years ago

Fixed.

https://github.com/lc-soft/LCUI/commit/9995b23bebb643cf1e74c544922db5028ef4eae7#diff-e0a052a143a1fd2418b69fd5fcf24ee2R58

LCUI_TextStyle::has_pixel_size is not initialized before it is used.

void TextStyle_Init( LCUI_TextStyle data )
{
    data->has_style = FALSE;
    data->has_weight = FALSE;
    data->has_family = FALSE;
+   data->has_pixel_size = FALSE;
    data->has_back_color = FALSE;
    data->has_fore_color = FALSE;