Closed
Bug 1124344
Opened 10 years ago
Closed 10 years ago
css letter-spacing does not affect mono-space tabs
Categories
(Core :: Layout, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: rui.damas, Unassigned)
References
Details
(Keywords: testcase)
Attachments
(1 file)
7.65 KB,
image/png
|
Details |
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/39.0.2171.65 Chrome/39.0.2171.65 Safari/537.36
Steps to reproduce:
there is an image in attach.
Actual results:
mono-space tabs have wrong size with letter-spacing.
Expected results:
mono-space tabs should have size complying with letter-spacing.
Comment 1•10 years ago
|
||
Can you provide an HTML/CSS testcase to illustrate what you mean (e.g. the bits you used to generate the screenshot), as well as provide more detail as to what exactly you think is going wrong here?
In particular, you say it has the "wrong size" - are you saying it's getting spacing it shouldn't have, or misses spacing it should have, or has spacing but should have different spacing? It's not clear to me which you're saying is happening, by looking at your screenshot.
I am not a spec reader, but a quick look at CSS3 suggests that letter-spacing applies between typographic character units, and that for the purposes of the spec, that includes things that unicode thinks are either Letters or Numbers, which a spacing character like space or tab isn't.
Component: Untriaged → Layout
Flags: needinfo?(rui.damas)
Keywords: testcase-wanted
Product: Firefox → Core
what you see in the screenshot are the first 2 lines of a text editor that i'm coding... they are generated by javascript... each letter is inside its own span element, all inside a div (__display)... i apply the css to all childs... i bumped into this when, at first, using padding for letter spacing, leads to this problem... seams logic to me by using letter-spacing should solve this specially if is a mono-spaced font.
.__editor .__text {
letter-spacing: 1px;
}
those are 2 screenshots... i glued them with gimp (chromium does the same: screenshot in attach).
what i'am saying is that the tab size does to take in account the letter-spacing (which may apply the letter-spacing at tab boundaries, but the "internal space" seams to be wrong, as if each space inside the tab is wrong)... you can see the difference in the screenshot i sent first.
"letter-spacing applies between typographic character units" ... while this may make some sense in "typographic" theory... in practice makes no sense for mono-spaced text loose its mono-spaciness... right?
Flags: needinfo?(rui.damas)
* correction of last message: where is __display should be _text
*... and the chromium screenshot is here: https://code.google.com/p/chromium/issues/detail?id=450720
<!-- test case -->
<pre style="letter-spacing: 5px;">
123456789
	9
</pre>
<pre>
123456789
	9
</pre>
please don't tell me that i should implement tab algorithms (with individual spaces) for my editor: that would be ridiculous... letter-spacing should comply to mono-space rules (tabs are actually made of typographic units (spaces)... right?... coders... common-sense... :)
Comment 7•10 years ago
|
||
Unless I'm reading the spec wrong (quite possible!) I expect this would need a spec change. I don't have the expertise to determine whether your suggestion is as sensible as you... suggest. :-)
Boris?
Flags: needinfo?(bzbarsky)
Keywords: testcase-wanted → testcase
Comment 8•10 years ago
|
||
Yep, as far as I can tell we're doing exactly what the spec says. The right place to talk about spec changes is www-style@w3.org.
Flags: needinfo?(bzbarsky)
can you leave here the link (or copy/past) for the spec (or part) you read... where explains how to calculate tabs (i presume).
i would like to read give it a look before sending an email to that www-style@w3.org referring this page...
weeee: i found a bug in the spec! :D
in the meanwhile you should fix this... since it is wrong.
mono-space is mono-space, if does not apply to typo-rules make an exception for it...
aka: can you suggest any other workaround?..
ty, r.
Comment 10•10 years ago
|
||
http://www.w3.org/TR/CSS21/text.html#white-space-model says:
All tabs (U+0009) are rendered as a horizontal shift that lines up the start edge of
the next glyph with the next tab stop. Tab stops occur at points that are multiples of
8 times the width of a space (U+0020) rendered in the block's font from the block's
starting content edge.
Note that this says nothing about converting tabs to spaces or letter-spacing affecting tab stops.
Also note that this depends on the _block'_s font, while letter-spacing can be applied to inlines inside the block and so forth.
> in the meanwhile you should fix this... since it is wrong.
It's not clear to me that it's wrong is the point, so we'd rather not start randomly violating the spec unless there is a clear indication it will change.
Reporter | ||
Comment 11•10 years ago
|
||
... i cannot read in that text nothing that prevents letter-spacing from applying to the "multiples of
8" (that actually depends on the chars before the tab) " times the width of a space (U+0020) rendered in the block's font", and a space next to another or mores spaces (a tab) must comply to it's letter-space context... presume that it must no?... really?... after reading that i still expect that letter-spacing is taken in account in tabs, and i see no objection... by reading, it would be easier for me to think that all tabs render 8 chars than to think that letter-spacing does not apply... does not talk about tab size (in characters) variation, yet you know how tabs are rendered in different sizes depending on the position... come on, run the test case and admit: that is ridiculous... because it simply is :P
"Also note that this depends on the _block'_s font, while letter-spacing can be applied to inlines inside the block and so forth." ... sorry, did not understand what you meant.
Note that the units of tab character size is in characters.
https://developer.mozilla.org/en-US/docs/Web/CSS/tab-size
... if the tab is in a letter-spaced context, part of the text, how can we say that mono-space complies to mono-space?
to me is quite clear that it is, somehow, wrong... if not for all fonts, than for mono-space it is... if this is wrong, then there should exist a solution to allow this (though i don't see any other)... is only natural that i want to use 1px of letter-spacing and keep the tab sizes right, right coders: that is the usefulness of mono-space.
... so: i need this working... i'm sent bellow to www-style@w3.org
subject: spec complain: css letter-spacing in tabs not clear
please help us on this bug, we are having spec interpretation issues:
https://bugzilla.mozilla.org/show_bug.cgi?id=1124344
Comment 12•10 years ago
|
||
> i cannot read in that text nothing that prevents letter-spacing from applying
The text is pretty clear: the tab stops are spaced at 8*(width of U+0020 in block's font). There's no letter-spacing involved.
> and a space next to another or mores spaces
There are no actual spaces. There are tab stops, at certain distances apart from each other.
> it would be easier for me to think that all tabs render 8 chars
I have no idea how you would get that from the spec language here.
> yet you know how tabs are rendered in different sizes depending on the position
Yes, it says "next tab stop". Which is a different distance away depending on where you are, obviously, because the tab stop positions are fixed.
> sorry, did not understand what you meant
Consider the rendering of this case:
<pre>
<span style="letter-spacing: 1em">123456789</span>
<span style="letter-spacing: 1em">	9</span>
<span>	9</span>
</pre>
I think the only one having spec interpretation issues is you. The spec is very clear, though it doesn't say what you want. But I can't tell what you'd even want in the testcase with letter-spacing on the <span>s.
Comment hidden (abuse-reviewed) |
Comment 14•10 years ago
|
||
> you really look at our mono-space test cases and feels it's right?
It's following the spec. That may or may not be the same thing, depending.
> if it does not work right, should change
Defining "right" in all circumstances here is not simple. But again, the spec may want changing, depending on how important people judge this use case and how complicated things get when one tries to address it. This is why I suggested you contact the standards group.
Until then, I'm going to stop wasting my time on this. This bug is invalid unless the spec changes.
> give-me a workaround then!
Use JS to expand out tabs into the right number of spaces? There is no pure-CSS workaround; CSS proper is not very good with working with tabs, because tabs don't make much sense in situations when multiple different fonts at multiple different sizes are involved.... Sad, but that's life.
> but will someone else with more common-sense of reality talk to me
You know, insulting people is not a good way to get them to help you.
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → INVALID
Comment hidden (abuse-reviewed) |
Given the model in:
http://dev.w3.org/csswg/css-text/#white-space-phase-2
http://dev.w3.org/csswg/css-text/#tab-size-property
I think it's reasonably clear that if letter-spacing did apply, it would be the letter-spacing of the block.
OS: Linux → All
Hardware: x86_64 → All
Comment hidden (abuse-reviewed) |
Comment hidden (abuse-reviewed) |
Comment hidden (abuse-reviewed) |
Comment 20•10 years ago
|
||
Please stop spamming this bug.
Your mail to the list is presumably in the moderation queue, since you didn't subscribe before sending. It hasn't come through to the list yet.
Updated•10 years ago
|
Restrict Comments: true
You need to log in
before you can comment on or make changes to this bug.
Description
•