Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too long text is silently discarded #2

Open
hlovdal opened this issue Jan 6, 2020 · 3 comments
Open

Too long text is silently discarded #2

hlovdal opened this issue Jan 6, 2020 · 3 comments

Comments

@hlovdal
Copy link

hlovdal commented Jan 6, 2020

With a template like

<img src="{{label_tools.qr_code(label_id)}}"/>
<span class='label'>{{ label_text }}</span>

css style like in README.rst and records like

records= [
...
    dict(label_id="112", label_text="123456789012"),
    dict(label_id="113", label_text="1234567890123"),
    dict(label_id="114", label_text="12345678901234"),
    dict(label_id="115", label_text="123456789012345"),
    dict(label_id="116", label_text="1234567890123456"),
    dict(label_id="117", label_text="12345678901234567"),
    dict(label_id="118", label_text="123456789012345678"),
...

all labels after "12345678901234" only contains the QR code while the text is blank.

One thing is not handling auto-scaling or word splitting, but silently dropping input is really bad. Could you please fix to at least give a warning/error?

@Zulko
Copy link
Member

Zulko commented Jan 6, 2020

Can you provide a full example, with HTML, CSS and python? I suspect that the issue here is not "dropping input" but a formatting issue: when the label is too long, it gets printed on a new line that falls outside of the printed area of the label. This could be partially fixed by CSS, using either text-overflow: ellipsis; or word-break: always;.

@W-M-D
Copy link

W-M-D commented Feb 12, 2020

I too am having this issue. I'm re writing a script with your library. I need to resize the text so it fits the label. No idea how to do it with css. Have tried multiple ways :/ .

@Zulko
Copy link
Member

Zulko commented Feb 12, 2020

You could decide the font size (or even the page size) based on the label length, on the python side, since the template uses Jinja.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants