Closed
Bug 125777
Opened 24 years ago
Closed 24 years ago
The default fonts for non-native system are incorrect
Categories
(Core :: Internationalization, defect)
Tracking
()
VERIFIED
FIXED
People
(Reporter: amyy, Assigned: shanjian)
Details
(Keywords: intl)
Attachments
(1 file, 2 obsolete files)
|
1.92 KB,
patch
|
asa
:
review+
asa
:
superreview+
asa
:
approval+
|
Details | Diff | Splinter Review |
Build: 02-15 trunk build
Steps:
[Case one: native system]
1. Launch browser and go to Edit | preferences | Appearance | Fonts.
2. Check the font for the language that same as OS language, e.g:
On Japanese windows system I got fonts for Japanese:
Serif: MS P MeiCho, Sans-Serif & Monospace: MS P Gothic
Cursive and Fantasy: Fixedsys
On SimpChinese windows system I got fonts for SimpChinese:
Serif, Sans-Serif and Monospace: SongTi
Cursive and Fantasy: Fixedsys
[Case two: non-native system]
By doing the same step as in case one on non-native system:
On WinXP-SimpChinese, fonts for Japanese:
All fonts are specified as MSGothic even I have all the Japanese fonts
available in my system
On WinXP-JA, WinME-JA, fonts for SimpChinese:
All fonts are specified as MSHei.
Seems we can not pick up the right fonts on non-native system. I assume this
will happen on all platforms.
| Reporter | ||
Comment 1•24 years ago
|
||
-> nsbeta1
Comment 2•24 years ago
|
||
How do we know that non-systems may have all the fonts
that are defaults for the native systems? There will be no
guarantee that all the fonts are available on non-native
systems. Some users may have one font but not others. As I recall,
these font names are hard coded for native systems. They are
predictable because they ship with the fonts. For non-native
systems, hard coding of the names is very difficult.
| Reporter | ||
Comment 3•24 years ago
|
||
Do we have some priority list for each language on non-native system?
like on non-SimpChinese system, we currently use MsHei instead of Song that
cause the page display is not good.
| Assignee | ||
Comment 4•24 years ago
|
||
take this one from roy, it is related with one of my bug.
Assignee: yokoyama → shanjian
| Assignee | ||
Comment 5•24 years ago
|
||
| Assignee | ||
Comment 6•24 years ago
|
||
Using "font.name.serif.zh-CN" as example, we now have a fallback list called
"font.name-list.serif.zh-CN". If the font could not be find in previous
preference, the later name lish should be tried. This logic is implemented in
gfx code, but not in preference dialog code.
Status: NEW → ASSIGNED
| Assignee | ||
Comment 7•24 years ago
|
||
Naoki/alecf, could you r/sr?
Comment 8•24 years ago
|
||
shanjian, does your patch refer to any hard-coded list of
fonts? For example, how is the font.name-list.serif.zh-CN
created? Manually or automatically? If automatically, how
is the status of more commonly used fonts reflected in that
list? Soem more explanation would highly appreciated.
Comment 9•24 years ago
|
||
What is the format of "font.name-list.serif.zh-CN"? Does that allow any number
of names to be listed? I am asking because of 'for (;;)' in the patch.
| Assignee | ||
Comment 10•24 years ago
|
||
>> does your patch refer to any hard-coded list of
>>fonts?
"font.name-list.serif.zh-CN" is specified in the same way as
"font.name.serif.zh-CN". For windows, that's in "winpref.js". And yes, fonts for
each language group are hardcoded in that file. The most direct reason to
implement that fall back list is because on localized CJK system, some fonts use
localized name. This mechanism enabled us to pick up the best available default
font for certain lanuage group.
>>What is the format of "font.name-list.serif.zh-CN"? Does that allow any number
>>of names to be listed? I am asking because of 'for (;;)' in the patch.
The format is the same as css font specification. It is coma separated name
list. That's why I have to implement it with a loop. Following is an line taken
from winpref.js:
pref("font.name-list.monospace.ja", "MS Gothic, MS Mincho, MS PGothic, MS PMincho");
Comment 11•24 years ago
|
||
What does "nameList.length" have? In your example would that be four? If so, why
isn't that used to control the loop?
| Assignee | ||
Comment 12•24 years ago
|
||
The "nameList" is a string contains coma separated names, it is not a list data
structure itself. Its length is string length.
Comment 13•24 years ago
|
||
Question:
In your example, which one is supposed to be selected, "MS Gothic" or "MS
PMincho"? My assumption is "MS Gothic" because "MS PMincho" is propotional.
pref("font.name-list.monospace.ja", "MS Gothic, MS Mincho, MS PGothic, MS PMincho");
Comment 14•24 years ago
|
||
Can you write down specs for the behavior in non-programming terms?
Font display has important implication for users and we don't want
to make changes without that spec understood completely.
Comment 15•24 years ago
|
||
> "font.name-list.serif.zh-CN" is specified in the same way as
> "font.name.serif.zh-CN". For windows, that's in "winpref.js".
> And yes, fonts for each language group are hardcoded in that file.
Does the hard-coded list include CJK fonts from Windows XP & Win 2000,
the newer platforms which may have added new fonts for these languages?
Comment 16•24 years ago
|
||
this is a low priority bug than others.
it is a not a all bug bug a "all windows" bug.
nsbeta1+ bug lower priority than others.
also, before check in code , verify the patch with other paltforms. (mac, linux)
and do no harm there.
Comment 17•24 years ago
|
||
Comment on attachment 70165 [details] [diff] [review]
patch
you should be using split(), not doing hand-parsing
it looks something like:
fontlist = nameList.split(/, /);
for (i=0; i<fontList.length; i++) {
dataEls = selectElement.listElement.getElementsByAttribute("value",
fontList[i]);
....
}
You'll have to look up the exact syntax
Attachment #70165 -
Flags: needs-work+
| Assignee | ||
Comment 18•24 years ago
|
||
alecf, I tried "split", but it does not work very well. Using following example
for explaination,
pref("font.name-list.monospace.zh-CN", "MS Hei, MS Song");
Since space character " " should be kept inside a font name, it should not be
used as a separator by itself. We can use ", " either because we don't know if
there is space after coma or not, and how many space will be there. It should
work by using split(",") and then truncate space later, but I thought that might
not be optimal because it will lead to extra string copy and possibily memory
allocation.
Comment 19•24 years ago
|
||
Question:
In your example, which one is supposed to be selected, "MS Gothic" or "MS
PMincho"? My assumption is "MS Gothic" because "MS PMincho" is propotional.
pref("font.name-list.monospace.ja", "MS Gothic, MS Mincho, MS PGothic, MS PMincho");
| Assignee | ||
Comment 20•24 years ago
|
||
We try them in the order of list. If "MS Gothic" is available in the system, it
will be selected, otherwise "MS Mincho, MS PGothic, MS PMincho" will be tried in
order until we find one available. If none of the listed fonts are available,
the first font in the system which declares to support that language group will
be selected.
Comment 21•24 years ago
|
||
Comment on attachment 70165 [details] [diff] [review]
patch
r=nhotta
Could you rename 'index' and 'lastIndex' to indeicate that they are character
index instead of index to strings?
Attachment #70165 -
Flags: review+
| Assignee | ||
Comment 22•24 years ago
|
||
I don't have any strings to index, it shouldn't cause any confusion.
Comment 23•24 years ago
|
||
Comment on attachment 70165 [details] [diff] [review]
patch
oh, sorry I was trying to research this and I had some simpler solutions. I had
been thinking of perl when I put the regular expression as a parameter to
split(). Anyway, it's just one more line to do the whitespace stripping:
var stripWhitespace = /^\s*(.*)\s*$/;
var fontNames = nameList.split(",");
for (font in fontNames) {
selectVal = font.replace(stripWhitespace,"$1");
}
you might have to tweak that slightly but thats the basic idea - much simpler!
| Assignee | ||
Comment 24•24 years ago
|
||
Attachment #70165 -
Attachment is obsolete: true
| Assignee | ||
Comment 25•24 years ago
|
||
It is good to know there is such trick to strip space characters. Is there any
concern about the speed as regular expression is involved? It shouldn't be a
problem here, but I just like to know.
| Assignee | ||
Comment 26•24 years ago
|
||
Comment on attachment 70937 [details] [diff] [review]
new patch as suggested by alecf
carry over naoki's review
Attachment #70937 -
Flags: review+
Comment 27•24 years ago
|
||
Comment on attachment 70937 [details] [diff] [review]
new patch as suggested by alecf
much easier to understand. Can you just add some blank lines so everything
isn't all crammed together?
sr=alecf with this added spacing
Attachment #70937 -
Flags: review+ → superreview+
Comment 28•24 years ago
|
||
oh, to answer your question - regular expressions are actually pretty fast -
especially if you compile them in advance like you've done here.. i.e. if you
use them again, avoid this:
for (...) {
var regex = /.../; // this compiles this regular
// expression every time you go through the loop
}
using replace() minimizes the string copying as well - in the previous patch, JS
would have probably made about 5 copies of the string before finally ending up
with the parsed string list.
Comment 29•24 years ago
|
||
shanjian, please answer the question in comment #14.
| Assignee | ||
Comment 30•24 years ago
|
||
Attachment #70937 -
Attachment is obsolete: true
| Assignee | ||
Comment 31•24 years ago
|
||
My patch does change any existing specification. I will try to give more
background imformation here.
Originally, we have item like "font.name.serif.zh-CN" to specify the default
generic font for certain language group. The limitation is that it only allow us
to specify one font name. The same font in localized and non-localized system
might have different names. If the specified font name there can not be found,
mozilla will pick one and that one might not be the best one on system. For
example, mozilla will pick "MS Hei" just because it's alphabetic order is before
"MS Song" on Chinese windows. Without any other hints, we can ask mozilla do
better than that. "font.name-list.serif.zh-CN" was later added to allow user to
specify a list of fonts if the one mentioned before could not be found.
The problem this bug aimed to fix is to reveal to user this internal logic. Both
of those preference items are predefined in our code. win2k and winxp might have
some new fonts available, but so far we don't have any reason to update our list.
If one of those new fonts does look superior to our existing default, we could
update our current preference setting. But that should be the concern of a
different bug.
| Assignee | ||
Comment 32•24 years ago
|
||
"My patch does change any existing specification" should be
"My patch does NOT change any existing specification"
Comment 33•24 years ago
|
||
Comment on attachment 70975 [details] [diff] [review]
patch added some spacing.
a=asa (on behalf of drivers) for checkin to the 1.0 trunk
Attachment #70975 -
Flags: superreview+
Attachment #70975 -
Flags: review+
Attachment #70975 -
Flags: approval+
| Assignee | ||
Comment 34•24 years ago
|
||
fix checked in to trunk.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
| Reporter | ||
Comment 35•24 years ago
|
||
Fixed was verified on recently trunk build.
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•