Skip to content

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

@robwhitaker

Description

@robwhitaker

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions