Skip to content

TextBoxWidget: handle tabs and tabstops#5870

Merged
poire-z merged 2 commits intokoreader:masterfrom
poire-z:textbboxwidget_tabs
Feb 18, 2020
Merged

TextBoxWidget: handle tabs and tabstops#5870
poire-z merged 2 commits intokoreader:masterfrom
poire-z:textbboxwidget_tabs

Conversation

@poire-z
Copy link
Copy Markdown
Contributor

@poire-z poire-z commented Feb 16, 2020

Don't display a tofu glyph when meeting a tab (none of our fonts have a glyph for it).
New parameter: TextBoxWidget.tabstop_nb_space_width, that defaults to 8, to ensure tabstops in the usual left aligmnent.
Needs a bump for base/xtext.cpp koreader/koreader-base#1049.
Closes #5837,

Defaulted to 8 spaces, because our spaces are really small and 4 was really tiny.
Also, only for TextBoxWidget - makes no real sense in TextWidget that hopefully only gets our own text or filenames.

I initially thought: why bother? as all our input is mostly tab-free (most dictionaries, Wikipedia, Google translate results, our own Lua code), except, as seen, some dict - and possibly some text files edited with TextEditor.
So, well, let's have a go: if it's not handled correctly, or the trick with text justification is really ugly, it won't affect much of our usual UI. And it's not that intrusive into the usual code, so, let's have it.

image

When text is justified, space extension is done only on spaces after the last tab on the line (which is a bit ugly, but well... haven't check how other text editors do it):
image

image


This change is Reviewable

Don't display a tofu glyph when meeting a tab (none of
our fonts have a glyph for it).
New parameter: TextBoxWidget.tabstop_nb_space_width,
that defaults to 8, to ensure tabstops in the usual
left aligmnent.
@Frenzie Frenzie added this to the 2020.03 milestone Feb 16, 2020
@NiLuJe NiLuJe mentioned this pull request Feb 17, 2020
@poire-z poire-z merged commit 611c423 into koreader:master Feb 18, 2020
@poire-z poire-z deleted the textbboxwidget_tabs branch February 18, 2020 12:24
mwoz123 pushed a commit to mwoz123/koreader that referenced this pull request Mar 29, 2020
Don't display a tofu glyph when meeting a tab (none of
our fonts have a glyph for it).
New parameter: TextBoxWidget.tabstop_nb_space_width,
that defaults to 8, to ensure tabstops in the usual
left aligmnent (or right when para is RTL).
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

Successfully merging this pull request may close these issues.

TAB-character (ascii 9) is not displayed correctly for Stardict dictionaries with sametypesequence m and x

2 participants