haxeui-hxwidgets icon indicating copy to clipboard operation
haxeui-hxwidgets copied to clipboard

Increasing label font size without specifying a width causes the text to clip

Open robwhitaker opened this issue 2 years ago • 5 comments

Expected Behavior

The label should increase in size to fit the text inside it instead of clipping the text. This is the behavior observed in other backends I've tried (html5, heaps-hl); it only seems to clip while using the hxwidgets backend.

Current Behavior

The label doesn't scale to fit the text it contains if you change the font size via CSS. The label retains its dimensions as if the default font size were used, thus clipping the text if the font size is bigger than default. This only seems to occur if the width of the label isn't specified.

Steps to Reproduce (for bugs)

  1. Create a default project with the hxwidgets backend (haxelib run haxeui-core create hxwidgets)
  2. Add a label with a larger font size than default and no specified width to assets/main-view.xml (e.g. <label text="this text will clip" style="font-size:30px" />)
  3. Compile and run the application; the text should be clipped.

Media

Using the heaps-hl backend (no clipping): image

Same code using the hxwidgets backend (clipping): image

Code that produced these screenshots below.

Test app / minimal test case

Default hxwidgets app with the following modifications:

assets/main-view.xml:

<hbox width="100%" height="100%">
  <style>
    .label {
      font-size: 25px;
    }
    .label.clipped {
      background-color: red;
      color: white;
    }
    .label.not-clipped {
      background-color: green;
      color: white;
      width: 100%;
    }
  </style>
  <label text="clipped" styleName="clipped" />
  <label text="not clipped" styleName="not-clipped"/>
</hbox>

src/MainView.hx:

package;

import haxe.ui.containers.HBox;

@:build(haxe.ui.ComponentBuilder.build("assets/main-view.xml"))
class MainView extends HBox {
  public function new() {
    super();
  }
}

Your Environment

  • Version used:
    $ haxe --version
    4.2.5
    
    $ wx-config --version
    3.2.2
    
    $ gtk4-launch --version
    4.10.4
    
    $ haxelib list
    format: [3.6.0]
    haxeui-core: [1.6.0]
    haxeui-heaps: [1.6.0]
    haxeui-html5: [1.6.0]
    haxeui-hxwidgets: [1.6.0]
    heaps: [1.10.0]
    hlopenal: [1.5.0]
    hlsdl: [1.13.0]
    hxcpp: [4.3.2]
    hxWidgets: [1.11.0]
    
  • Environment name and version (e.g. Chrome 39, node.js 5.4): Replicated in:
    • XMonad 0.17.2 with no DE
    • KDE Plasma 5
  • Operating System and version (desktop or mobile): NixOS 23.11 (desktop)

robwhitaker avatar Sep 11 '23 19:09 robwhitaker

Hi, can you use the git version os haxeui-* (include hxWidgets). Just to see if the behaviour is the same (it very we may be).

Cheers, Ian

ianharrigan avatar Sep 12 '23 06:09 ianharrigan

I tried to use the git versions for all of them, but I wasn't able to for haxeui-hxwidgets, so this is what I got:

$ haxelib list
haxeui-core: [1.6.0] git
haxeui-hxwidgets: [1.6.0]
hxcpp: [4.3.2]
hxWidgets: 1.11.0 [git]

With this setup, the clipping issue is the same.

When I did try to build with haxeui-hxwidgets using the git version, I got this compilation error:

$ haxe hxwidgets.hxml
wxWidgets version detected as 3.2.2
/projectdir/.haxelib/haxeui-hxwidgets/git/haxe/Timer.hx:39: characters 26-35 : hx.widgets.App has no field topWindow
/projectdir/.haxelib/haxeui-hxwidgets/git/haxe/Timer.hx:52: characters 43-52 : hx.widgets.App has no field topWindow
/projectdir/.haxelib/haxeui-hxwidgets/git/haxe/Timer.hx:53: characters 22-31 : hx.widgets.App has no field topWindow
/projectdir/.haxelib/haxeui-hxwidgets/git/haxe/Timer.hx:53: characters 22-31 : hx.widgets.App has no field topWindow
/projectdir/.haxelib/haxeui-hxwidgets/git/haxe/ui/backend/hxwidgets/behaviours/SliderTicks.hx:15: characters 45-53 : hx.widgets.Slider has no field tickFreq
/projectdir/.haxelib/haxeui-hxwidgets/git/haxe/ui/backend/hxwidgets/behaviours/SliderTicks.hx:27: characters 49-57 : hx.widgets.Slider has no field tickFreq

I do notice that haxeui-hxwidgets doesn't have a version number, just [git] in the haxelib list output (haxeui-hxwidgets: [git]). Is this normal? Not sure if I did something wrong while grabbing the git versions.

robwhitaker avatar Sep 13 '23 00:09 robwhitaker

try something like:

haxelib git haxeui-core https://github.com/haxeui/haxeui-core
haxelib git haxeui-hxwidgets https://github.com/haxeui/haxeui-hxwidgets
haxelib git hxWidgets https://github.com/haxeui/hxWidgets

the active version is surrounded by "[" and "]" so you want them all to say "[git]" (dont worry about hxcpp though, that one is fine)

ianharrigan avatar Sep 13 '23 07:09 ianharrigan

Ah, I was wondering what those brackets meant (very new to Haxe :sweat_smile:). Not sure what's different about those commands compared to what I did before (maybe I used the SSH git URL or something silly), but it worked this time:

$ haxelib list
haxeui-core: 1.6.0 [git]
haxeui-hxwidgets: [git]
hxcpp: [4.3.2]
hxWidgets: 1.11.0 [git]

Unfortunately, the clipping issue is still present.

robwhitaker avatar Sep 13 '23 07:09 robwhitaker

OK, thats fine then, its not a version issue its an issue that has been present since "forever"... thanks for confirming!

Cheers, Ian

ianharrigan avatar Sep 13 '23 07:09 ianharrigan