question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Labels With Different Font Size are Not Rendered Correctly

See original GitHub issue

Describe the bug

Labels can be passed a class. If this class gives the label a different font size, it renders outside the bounds of the block.

To Reproduce

Steps to reproduce the behavior:

  1. Add the following block definitions to the test blocks file:
{
    "type": "example_text_class",
    "message0": "%1",
    "args0": [
      {
        "type": "field_label",
        "name": "NAME",
        "text": "default",
        "class": "custom-text-class"
      }
    ],
    "colour": 230,
  },
  {
    "type": "example_text_class_image",
    "message0": "%2 %1",
    "args0": [
      {
        "type": "field_image",
        "src": "https://www.gstatic.com/codesite/ph/images/star_on.gif",
        "width": 50,
        "height": 50,
        "alt": "*",
        "flipRtl": false
      },
      {
        "type": "field_label",
        "name": "NAME",
        "text": "default",
        "class": "custom-text-class"
      }
    ],
    "colour": 230,
  },
  1. Add the following css to the playground:
.custom-text-class {
  fill: black;  /* for visibility*/
  font-size: 50px;
}
  1. Load the playground.
  2. Import the following XML.
<xml>
  <block type="example_text_class"/>
  <block type="example_text_class_image" y="50"/>
</xml>
  1. Observe how the text is rendered oddly. Especially on the block with the image.

Expected behavior

I expect the top of the text to be aligned with the top of the block (as that seems to be the current official behavior). The block should encapsulate all of the text.

Screenshots

Text_Classes

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Chrome
  • Version: 75

(I believe this is not browser specific)

Stack Traces

N/A

Additional context

I think the problem is probably caused by this line being a constant (since size_.height is constant).

The y attribute is also set by the abstract field class here, and then overriden by the above line.

I know all of the field sizing stuff is a little iffy atm, I just think this is an important test case.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
samelhusseinicommented, Feb 21, 2020

Sorry I meant to close the other one 😃

0reactions
BeksOmegacommented, Feb 21, 2020

From my testing I think this still occures. This issue is for classes that are applied directly to the label field.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix Misaligned Labels Templates?
Check your printer settings; Decrease the font size or reduce the amount of text; Make sure you are using the correct labels. 1....
Read more >
Some characters missing or cut off when displayed on screen ...
The zoom percentage that the document is set to may cause characters to have the top or bottom portion of the screen font...
Read more >
Problem: The text and annotation sizes are different when ...
In ArcGIS Pro, the text and annotation sizes are different when viewed in the same map scale even though the same type of...
Read more >
WPF Label FontSize and FontFamily correct in designer, but ...
I have a problem on some controls such as Label where I have set FontSize , FontWeight , FontFamily etc. All values are...
Read more >
Change the Font Style, Size and Text Colors | Avery.com
Find answers to the most frequently asked questions about Avery products and software. We're here to help!
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found