Closed Bug 125777 Opened 24 years ago Closed 24 years ago

The default fonts for non-native system are incorrect

Categories

(Core :: Internationalization, defect)

x86
Windows 98
defect
Not set
major

Tracking

()

VERIFIED FIXED

People

(Reporter: amyy, Assigned: shanjian)

Details

(Keywords: intl)

Attachments

(1 file, 2 obsolete files)

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.
-> nsbeta1
Severity: normal → major
Keywords: intl, nsbeta1
QA Contact: ruixu → ylong
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.
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.
take this one from roy, it is related with one of my bug.
Assignee: yokoyama → shanjian
Attached patch patch (obsolete) — — Splinter Review
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
Naoki/alecf, could you r/sr?
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.
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.
>> 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");
What does "nameList.length" have? In your example would that be four? If so, why isn't that used to control the loop?
The "nameList" is a string contains coma separated names, it is not a list data structure itself. Its length is string length.
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");
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.
> "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?
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.
Keywords: nsbeta1 → nsbeta1+
OS: All → Windows 98
Hardware: All → PC
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+
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.
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");
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 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+
I don't have any strings to index, it shouldn't cause any confusion.
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!
Attached patch new patch as suggested by alecf (obsolete) — — Splinter Review
Attachment #70165 - Attachment is obsolete: true
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.
Comment on attachment 70937 [details] [diff] [review] new patch as suggested by alecf carry over naoki's review
Attachment #70937 - Flags: review+
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+
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.
shanjian, please answer the question in comment #14.
Attachment #70937 - Attachment is obsolete: true
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.
"My patch does change any existing specification" should be "My patch does NOT change any existing specification"
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+
fix checked in to trunk.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
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.

Attachment

General

Creator:
Created:
Updated:
Size: