Closed
Bug 146622
Opened 23 years ago
Closed 23 years ago
PrefEnumCallback does not work as expected
Categories
(Core :: Internationalization, defect)
Tracking
()
VERIFIED
FIXED
mozilla1.0.1
People
(Reporter: masaki.katakai, Assigned: roland.mainz)
References
Details
(Keywords: intl)
Attachments
(1 file, 4 obsolete files)
3.75 KB,
patch
|
roland.mainz
:
review+
scc
:
superreview+
jesup
:
approval+
|
Details | Diff | Splinter Review |
I found serious problem on nsFontMetricsGTK.cpp. If font can not be
found for the default language in preferece, we look for all fonts prefs
by using PrefEnumCallback(), but it does not work. It always looks for
'*' for search. So it returns unexpected result.
I found this problem on Solaris. Korean user prefers "ksc5601.1992-3"
for Korean language so they defined the font in preference. It works
fine on ko locale. But on UTF-8 locale, the font exists but it can not
be picked up. It always uses "ksc5601.1987-0" by this problem.
Look at the log below, the first matched pref is "font.name.monospace.tr"
and it's not defined in user prefs. So "" is returned and the
current codes is trying to find the font by "" in TryNode().
TryNode() looks for fonts by "aFFREName = *". If user pref
is not defined, this always trys "*" and stops. We should
avoid "" search at TryNode().
PrefEnumCallback, nsFontMetricsGTK.cpp 4380
TryNode aName = , nsFontMetricsGTK.cpp 4165
TrySubplane: wild-card the encoding, nsFontMetricsGTK.cpp 4216
TryNodes aFFREName = *, nsFontMetricsGTK.cpp 4137
load font *-symbol-adobe-fontspecific, nsFontMetricsGTK.cpp 3460
load font *-gothic-ksc5601.1987-0, nsFontMetricsGTK.cpp 3460
Reporter | ||
Comment 1•23 years ago
|
||
Reporter | ||
Comment 2•23 years ago
|
||
Reporter | ||
Comment 3•23 years ago
|
||
I've put proposed patch.
1. If len=0, TryNode() should return.
2. I changed if(value) to if(value.get()) according with other codes.
3. The following codes should be in if (value.get()) { }
s->mFont = s->mMetrics->TryLangGroup(s->mMetrics->mLangGroup, &name,
s->mChar);
if (s->mFont) {
NS_ASSERTION(s->mFont->SupportsChar(s->mChar), "font supposed to support
this char");
return;
}
Reporter | ||
Comment 4•23 years ago
|
||
Brian, what do you think?
Comment 5•23 years ago
|
||
This seems okay.
Is there something other than a whitespace change here:
- s->mFont = s->mMetrics->TryLangGroup(s->mMetrics->mLangGroup, &name,
s->mChar);
- if (s->mFont) {
- NS_ASSERTION(s->mFont->SupportsChar(s->mChar), "font supposed to support
this char");
- return;
+ s->mFont = s->mMetrics->TryLangGroup(s->mMetrics->mLangGroup, &name,
s->mChar);
+ if (s->mFont) {
+ NS_ASSERTION(s->mFont->SupportsChar(s->mChar), "font supposed to support
this char");
+ return;
+ }
Reporter | ||
Comment 6•23 years ago
|
||
I've just moved those codes into inside of if (value.get()) {}.
Updated•23 years ago
|
Attachment #84882 -
Attachment is obsolete: true
Comment 7•23 years ago
|
||
Comment on attachment 84883 [details] [diff] [review]
Sorry I put wrong file. here is correct one.
looks okay to me
r=bstell@ix.netcom.com
Attachment #84883 -
Flags: review+
Reporter | ||
Comment 8•23 years ago
|
||
This bug does not happen very often. This problem happens
if users change font preference but the font is not available
in the user environment. At that case, prefs.js will contain,
user_pref("font.name.monospace.tr", "");
Assignee: yokoyama → katakai
Reporter | ||
Comment 9•23 years ago
|
||
Reporter | ||
Comment 10•23 years ago
|
||
Brian,
Sorry for dup work but the check is needed also in
TryLangGroup().
Could you r= please?
Comment 11•23 years ago
|
||
r=bstell@ix.netcom.com
Katakai: would you ask Jag to sr this?
Comment 12•23 years ago
|
||
Comment on attachment 85136 [details] [diff] [review]
check also needs in TryLangGroup()
One of the trunk builds has been crashing for me when I tried to submit patch
comments through this form, I didn't realize it also happened for this bug.
sr=jag, provided you fix the comments below:
>Index: nsFontMetricsGTK.cpp
>===================================================================
>RCS file: /cvsroot/mozilla/gfx/src/gtk/nsFontMetricsGTK.cpp,v
>retrieving revision 1.209
>diff -u -r1.209 nsFontMetricsGTK.cpp
>--- nsFontMetricsGTK.cpp 24 May 2002 00:00:28 -0000 1.209
>+++ nsFontMetricsGTK.cpp 27 May 2002 02:41:06 -0000
>@@ -4175,6 +4175,9 @@
> //
> // check the specified font (foundry-family-registry-encoding)
> //
>+ if (!(*aName).Length()) {
>+ return nsnull;
>+ }
if (aName->IsEmpty())
return nsnull;
>@@ -4236,6 +4239,9 @@
> //
> FIND_FONT_PRINTF((" TryLangGroup lang group = %s, aName = %s",
> atomToName(aLangGroup), (*aName).get()));
>+ if (!(*aName).Length()) {
>+ return nsnull;
>+ }
if (aName->IsEmpty())
return nsnull;
Attachment #85136 -
Flags: superreview+
Attachment #85136 -
Flags: review+
Assignee | ||
Comment 13•23 years ago
|
||
Comment on attachment 85136 [details] [diff] [review]
check also needs in TryLangGroup()
The patch needs to be ported to Xlib gfx, too - I'll file a new patch...
Attachment #85136 -
Flags: needs-work+
Assignee | ||
Comment 14•23 years ago
|
||
Attachment #84883 -
Attachment is obsolete: true
Attachment #85136 -
Attachment is obsolete: true
Assignee | ||
Comment 15•23 years ago
|
||
Stealing from katakai...
Assignee | ||
Updated•23 years ago
|
Status: NEW → ASSIGNED
Reporter | ||
Comment 16•23 years ago
|
||
Thank you Roland for your kindness,
I need to put this to both Trunk and Branch.
But could you please look at Jag's comments of
aName->IsEmpty() ?
Thank you.
Assignee | ||
Comment 17•23 years ago
|
||
Masaki Katakai wrote:
> Thank you Roland for your kindness,
No problem... :)
> But could you please look at Jag's comments of
> aName->IsEmpty() ?
Eeeeeekks... ;-(
I forgot that... sorry... new patch in a few secs...
Assignee | ||
Comment 18•23 years ago
|
||
Assignee | ||
Updated•23 years ago
|
Attachment #86572 -
Attachment is obsolete: true
Comment 19•23 years ago
|
||
Comment on attachment 86577 [details] [diff] [review]
New patch per jag's comments
sr=scc
Attachment #86577 -
Flags: superreview+
Assignee | ||
Comment 20•23 years ago
|
||
katakai:
Can you r= the new patch, please ?
Reporter | ||
Comment 21•23 years ago
|
||
Sure. I've verified the fix on GTK. The same codes
in Xlib. Looks good for me.
r=katakai
but I'm sorry I could not mar has-review for the attachment.
Assignee | ||
Comment 22•23 years ago
|
||
Masaki Katakai wrote:
> Sure. I've verified the fix on GTK. The same codes
> in Xlib. Looks good for me.
>
> r=katakai
Thanks!
> but I'm sorry I could not mar has-review for the attachment.
Uhm... what went wrong ? Which error did you get ?
Assignee | ||
Comment 23•23 years ago
|
||
Comment on attachment 86577 [details] [diff] [review]
New patch per jag's comments
Marking r=katakai per comment #21 ...
Attachment #86577 -
Flags: review+
Assignee | ||
Comment 24•23 years ago
|
||
Requesting a= for trunk and 1.0.1-branch...
Keywords: mozilla1.0.1
Target Milestone: --- → mozilla1.0.1
Assignee | ||
Updated•23 years ago
|
Blocks: xprint_machv
Comment 25•23 years ago
|
||
Checked in to trunk for Roland
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Comment 26•23 years ago
|
||
I'm not sure if I'm the right person to verify this code change. I'm change QA
contact to Frank right now. Please provide the test case or steps if need me
verify, thanks!
QA Contact: ylong → ftang
Assignee | ||
Comment 28•23 years ago
|
||
Requesting a= for 1.0.1-branch...
Comment 29•23 years ago
|
||
Comment on attachment 86577 [details] [diff] [review]
New patch per jag's comments
Approved for 1.0 branch. Please remove mozilla1.0.1+ when it's fixed and add
fixed1.0.1
Attachment #86577 -
Flags: approval+
Updated•23 years ago
|
Comment 31•23 years ago
|
||
katakai@japan.sun.com - can you verify on branch and trunk?
Reporter | ||
Comment 32•23 years ago
|
||
verified on both Trunk and 1.0.1 branch.
Status: RESOLVED → VERIFIED
Keywords: fixed1.0.1 → verified1.0.1
You need to log in
before you can comment on or make changes to this bug.
Description
•