Open
Bug 1178020
Opened 11 years ago
Updated 4 years ago
Input boxes default to about 29 characters long in Linux version
Categories
(Core :: Layout: Text and Fonts, defect)
Tracking
()
UNCONFIRMED
People
(Reporter: moschris, Unassigned)
References
()
Details
(Keywords: testcase)
Attachments
(2 files)
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:38.0) Gecko/20100101 Firefox/38.0
Build ID: 20150511103819
Steps to reproduce:
HTML input boxes with no width or size parameter are oversize. Those with only a SIZE parameter are also oversize. The default fits around 29 characters whereas the HTML standard says it should fit 20 characters. This only applies to Firefox on Linux: I'm using 38.0 for Ubuntu Canonical 1.0. On other platforms it seems to work fine
Actual results:
The attached file shows the problem if viewed on the right platform. For most browsers the first box is around the same length as the 150px box (on some as small as 123px). For Linux Firefox it's the same length as the 229px box. The effect is that web pages using the size parameter only the boxes spill out of the space provided. (I can supply screenshots if required.)
Expected results:
A box with space enough for 20 characters only
| Reporter | ||
Comment 1•11 years ago
|
||
| Reporter | ||
Updated•11 years ago
|
Updated•11 years ago
|
Comment 2•11 years ago
|
||
20 of which characters? The testcase is using a non-fixed-width font, so differente characters have different widths. Which exact font is being used in your case? What is its actual average character width? What is its max character width? What happens if you style the input with, say, "font-family: Times"?
Because what the spec says is to use "(size-1)×avg + max, where size is the character width to convert, avg is the average character width of the primary font for the element for which the algorithm is being run, in pixels, and max is the maximum character width of that same font, also in pixels."
Component: Layout: Form Controls → Layout: Text
Flags: needinfo?(moschris)
| Reporter | ||
Comment 3•11 years ago
|
||
The test case does not specify a font. In discussion on the forum (https://support.mozilla.org/en-US/questions/1065756#answer-738022), the consensus was that an "x" was normal and that's what I used. Certainly on most browsers (but not Firefox on Linux) it's pretty close. Maybe I should have submitted screenshots showing that. Do you want them?
Flags: needinfo?(moschris)
Comment 4•11 years ago
|
||
The question is what your particular system is configured to use as the font for input boxes and what that font's metric tables claim as its average character width.
Comment 5•11 years ago
|
||
And in particular, looking at our code, we use the width of an 'x' only if the font does not provide an average character width in its OS/2 table.
Comment 6•11 years ago
|
||
Also, how many copies of '0' fit in that text input? Is '0' the same width as 'x' in your font or wider?
| Reporter | ||
Comment 7•11 years ago
|
||
00000000000000000000
xxxxxxxxxxxxxxxxxxxx
I can easily answer your last question: they're the same length. As for the others it seems like the blind leading the blind. I can tell you that my default font is Arial 14pt but that's certainly not the font that appears in input boxes (and incidentally, I've just remeasured it at 31 rather than 29). If you can tell me where to find this information, I will supply it.
| Reporter | ||
Comment 8•11 years ago
|
||
I suppose I should add the numbers in the Advanced box:
Proportional: Serif 14
Serif: Arial
Sans-serif: Sans-serif
Monospace: monospace 14
Allow pages to choose their own fonts: ticked
Fallback character encoding: Default for current locale (English UK)
None of this terribly enlightening, particularly as I was always taught Arial was a sans-serif typeface.
| Reporter | ||
Comment 9•11 years ago
|
||
I tried loading the Perl Font::TTF::OS_2 package to answer this question but it came unstuck when I tried reading the tables with an error message:
Can't call method "seek" on an undefined value at /usr/local/share/perl/5.18.2/Font/TTF/Table.pm line 111.
The corresponding line reads:
$self->{' INFILE'}->seek($self->{' OFFSET'}, 0);
which means nothing to me, so I'm stuck at that point.
Comment 10•11 years ago
|
||
Chris, I think you should be able to see the name of the actual font
being used in Devtools: type F12 to open it, then click Inspector,
then select the <input> in the markup tree, then click Fonts in the
right panel, and then click "See all the fonts used in the page" there.
What does it say?
Flags: needinfo?(moschris)
| Reporter | ||
Comment 11•11 years ago
|
||
It says "FreeSans system" and "Ubuntu system".
(Actually F12 opened Firebug for me but no matter - I never have liked F keys.)
Flags: needinfo?(moschris)
| Reporter | ||
Comment 12•11 years ago
|
||
Sorry, if that was inconsistent with what I said before it's because I've been playing with the fonts. Under the earlier setting it would have been "Arial" and "Ubuntu". So maybe it's the latter we are talking about. When I look at samples it appears about 2.5% longer than Arial but I don't know what the tables say as I don't know how to access them.
Comment 13•11 years ago
|
||
Jonathan, could you help Chris out in terms of finding the font table info?
Flags: needinfo?(jfkthame)
Comment 14•11 years ago
|
||
(In reply to Boris Zbarsky [:bz] from comment #13)
> Jonathan, could you help Chris out in terms of finding the font table info?
The tool I normally use is ttx, from the fonttools package (https://github.com/behdad/fonttools/).
Flags: needinfo?(jfkthame)
| Reporter | ||
Comment 15•11 years ago
|
||
Ok, I've installed ttx and dumped the table from the file
/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-R.ttf
which seems to have as good a claim to being the required font as any. It's listed below. Does this help you? I'm afraid it means little to me. (Another candidate is Ubuntu-M.ttf whose xAvgCharWidth value=617.)
<OS_2>
<!-- The fields 'usFirstCharIndex' and 'usLastCharIndex'
will be recalculated by the compiler -->
<version value="3"/>
<xAvgCharWidth value="602"/>
<usWeightClass value="400"/>
<usWidthClass value="5"/>
<fsType value="00000000 00000000"/>
<ySubscriptXSize value="700"/>
<ySubscriptYSize value="650"/>
<ySubscriptXOffset value="0"/>
<ySubscriptYOffset value="140"/>
<ySuperscriptXSize value="700"/>
<ySuperscriptYSize value="650"/>
<ySuperscriptXOffset value="0"/>
<ySuperscriptYOffset value="477"/>
<yStrikeoutSize value="79"/>
<yStrikeoutPosition value="250"/>
<sFamilyClass value="0"/>
<panose>
<bFamilyType value="2"/>
<bSerifStyle value="11"/>
<bWeight value="5"/>
<bProportion value="4"/>
<bContrast value="3"/>
<bStrokeVariation value="6"/>
<bArmStyle value="2"/>
<bLetterForm value="3"/>
<bMidline value="2"/>
<bXHeight value="4"/>
</panose>
<ulUnicodeRange1 value="11100000 00000000 00000010 11111111"/>
<ulUnicodeRange2 value="01010000 00000000 00100000 01011011"/>
<ulUnicodeRange3 value="00000000 00000000 00000000 00000000"/>
<ulUnicodeRange4 value="00000000 00000000 00000000 00000000"/>
<achVendID value="DAMA"/>
<fsSelection value="00000000 01000000"/>
<usFirstCharIndex value="0"/>
<usLastCharIndex value="64260"/>
<sTypoAscender value="776"/>
<sTypoDescender value="-185"/>
<sTypoLineGap value="56"/>
<usWinAscent value="932"/>
<usWinDescent value="189"/>
<ulCodePageRange1 value="00100000 00000000 00000000 10011111"/>
<ulCodePageRange2 value="01010110 00000001 00000000 00000000"/>
<sxHeight value="520"/>
<sCapHeight value="693"/>
<usDefaultChar value="0"/>
<usBreakChar value="32"/>
<usMaxContext value="3"/>
</OS_2>
Updated•4 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•