Last Comment Bug 200589 - [BeOS] Mozilla cannot recognize some Japanese fonts
: [BeOS] Mozilla cannot recognize some Japanese fonts
: fixed1.8
Product: Core Graveyard
Classification: Graveyard
Component: GFX: BeOS (show other bugs)
: Trunk
: x86 BeOS
-- normal (vote)
: ---
Assigned To: Sergei Dolgov
: QA timeless
Depends on: 218134
  Show dependency treegraph
Reported: 2003-04-03 19:56 PST by Paul
Modified: 2009-01-22 10:17 PST (History)
5 users (show)
See Also:
QA Whiteboard:
Iteration: ---
Points: ---

patch to nsFontMetricsBeOS.cpp (707 bytes, patch)
2003-04-03 19:57 PST, Paul
no flags Details | Diff | Splinter Review
Fonts can't match correctly when aLangGroup is Unicode. (326 bytes, patch)
2003-04-25 09:19 PDT, Ryo Hattori
no flags Details | Diff | Splinter Review
Patch - fixes two UTF-8 issues and rounding (5.35 KB, patch)
2005-09-27 00:46 PDT, Sergei Dolgov
no flags Details | Diff | Splinter Review
patch (5.35 KB, patch)
2005-09-27 11:58 PDT, Sergei Dolgov
thesuckiestemail: review+
asa: approval1.8b5+
Details | Diff | Splinter Review

Description User image Paul 2003-04-03 19:56:18 PST
This was brought to my attention:

"Monospaced fonts are not displayed properly in Japanese due to certain quircks
in the way Mozilla and BeOS interact (don't know nor understand the details). As
a result, certain form elements do not display Japanese as they should."

patch to follow
Comment 1 User image Paul 2003-04-03 19:57:18 PST
Created attachment 119393 [details] [diff] [review]
patch to nsFontMetricsBeOS.cpp

proposed patch
Comment 2 User image Sergei Dolgov 2003-04-03 23:28:05 PST
Wish to see more details/explanations of this bug. Including screenshots.

Comment 3 User image Paul 2003-04-04 05:27:03 PST
Sergei, this was submitted to me by a friend in the Japanese community.  They
gave me a screenshot, but I don't have it with me at work.  I will submit it
this weekend.
Comment 4 User image Sergei Dolgov 2003-04-04 05:43:23 PST
I need a bit more than screenshot. URL, version of Mozilla, info about mozilla
settings when surfing those sites and info about fonts installed on system.
Problem with fonts and font metrics in current BeOS port is quite complex.
I'm working on this part of gfx too, and a'm afraid that this bug may be dup of
some existing bugs, misconfiguration, or bug related to already rewritten here
part of code. Better, if they speak english - let them contact me directly.

As you understand, in current form this bug is hardly worth even "New" status.
Comment 5 User image Jorge G. Mare (a.k.a. Koki) 2003-04-07 12:58:03 PDT

Under Preferences > Fonts, when you choose "Japanese" as the language, 
the "monospaced font' setting shows Courier (a non-Japanese font), and it is 
greyed out so it cannot be change. As a result, text boxes in forms do not 
display Japanese text properly. Specifically, when you enter Japanese text in a 
form text field, all you see is rectangles.

Here is some more info:

Mozilla version: confirmed on Mozilla 1.3 and 1.4a for netserver

URL: not specific to certain URLs. Problem happens whenever you enter Japanese 
into a form text field.

Installed fonts: default BeOS R5 JP fonts, including Haru Tohaba, which is 

To solve this problem, one of our guys produced a patch to allow selection of 
the desired monospaced font for the Japanese language, which seems to work 
fine. This is what we passed along to Paul.

The screenshot that Paul mentioned shows how it is possible to select the 
desired monospaced font for Japanese after the patch is applied.

Let me know if you need more info.


Comment 6 User image Sergei Dolgov 2003-04-07 14:46:17 PDT
1)Somehow it is problem with communication.
I asked several times on BeUserTalk, BeDevTalk and on BeShare help abput
providing info about non-western fonts and issues, as BeZilla now uses name
sniffing. But nobody answered - it seems that "Western" and "Asian" BeOS
comunities have deep gap inbetween. So i wish to add Nost frequent CJK fonts to
cathegory list, inspite for hieroglyphic alphabet those categories are rather
abstract - Serif, Sans-Serif, Monospaced-fixed, Cursive.

2)Second part of problem is that lot of CJK fonts don't report itself as fixed
in BeOS API (and not only in BeOS). This is why is started using name sniffing
instead call for IsFixed(). 
But seems that new half-implemented API method IsFullAndHalfFixed() works better
- at least using in my code this method i can see "Haru Tohaba" as fixed.

3)In order to understand and approve patch, i need to have those fonts by your
japanese friend which they supposed to be fixed, but are currently "invisible".
You can send me those fonts by e-mail or provide via BeShare.

4)We already had similar problem with text-fields and lists in japanese, but it
was fixed(rather hacked) to set those elements use be_plain_font. Because users
coouldn't find (good) CJK fonts which show itself as available for be_fixed_font
in BeOS system font preferences. 

5)But maybe for CJK case we should drop font-type detection at all and show all
 fonts in all categories as possible choice - as other platforms tend to do.
Comment 7 User image Ryo Hattori 2003-04-24 10:43:02 PDT
This patch was made by me.
It is enable to show a font name which contains Japanese characters.

Example screenshots are here.
bad :
good :

You can download 'Mikachan-Font' from

Comment 8 User image Sergei Dolgov 2003-04-24 11:06:42 PDT
Hai, Ryo,
I understand what this patch is for.
Unfortunately i still didn't get information i requested from Japanese BeZilla
fans via koki. 

I tested this patch, and it is safe for BeOS, inspite such kind of font names
seem illegal for Linux port. 
I asked lot of questions in my mail, in hope that  Jorge G. Mare will redirect
it to you, as his claims based on his own experience and pointed rather on
inproper settings than at this problem you trying to solve with this patch. My
question in that mail relate just to some CJK problems and are targeted to more
wide changes in nsFontMetricsBeOS.

I already have different (from CVS) version of that file in which i didn't met
any problems on sites pointed by Koki.

So i'm still waiting for reply and fonts with japanese names
Comment 9 User image Sergei Dolgov 2003-04-24 11:15:23 PDT
P.S. I'm asking for whole bunch of fonts with Japanes names, because your
download link don't work
Comment 10 User image Ryo Hattori 2003-04-25 08:47:43 PDT
Sorry, the correct URL is

Another fonts with japanese names is available from , mt_tare.lzh and mt_tare_p.lzh

Comment 11 User image Ryo Hattori 2003-04-25 09:19:54 PDT
Created attachment 121680 [details] [diff] [review]
Fonts can't match correctly  when aLangGroup is Unicode.

There is another problem with font preference.
FontMatchesGenericType is called with aLangGroup == "x-unicode".
I can't select Japanese fonts, except Haru and Haru Tohaba.
Comment 12 User image Paul 2003-06-22 20:26:59 PDT
Sergei, are you and Ryo still looking into this?  As I understand it, this is a
fairly BIG problem for Japanese users, and I would like to see it resolved ASAP.

Please let me know, so we can resolve this issue.
Comment 13 User image Sergei Dolgov 2004-11-02 03:11:11 PST
sets font classificator into promiscuous mode for unicode - so any font matches
and font type.
This approach was almost ok when Unicode was mostly used by CKJ sites, but now
lot of western pages also use UTF-8 as main encoding.

And due internal mozilla changes this isn't important anymore.
At times when this patch was submitted, Mozilla was very strict in taking in
account return value of the method, so only matched fonts were listed in
Now it is much more flexible - lists matched fonts above horizontal rule/divider
(as preffered fonts), but also list ALL remaining below divider.

Also i must admit again that method where this patch proposes changes is real
hack in BeOS, as BeOS API and system settings don't provide font type
information besides difference between fixed and proportional.

Second patch needs discussion with Mozilla CKJ/i18n gurus about legality of
non-ascii font names.
Comment 14 User image Sergei Dolgov 2004-11-05 03:38:09 PST
Comment on attachment 119393 [details] [diff] [review]
patch to nsFontMetricsBeOS.cpp

No need in this anymore:

As you see, there are ALL installed fonts in list for Unicode->Monospace
Comment 15 User image Sergei Dolgov 2004-11-05 03:42:10 PST
Comment on attachment 121680 [details] [diff] [review]
Fonts can't match correctly  when aLangGroup is Unicode.

Sorry, previous comment was for this patch.

Anyway, previous patch probably don't apply cleanly now, so need refreshing
Comment 16 User image Sergei Dolgov 2005-09-27 00:16:47 PDT
I will submit patch on fist topic, fixing UTF-8 hamdling, also UTF-8 bug in
nsRenderingContext soon.
Comment 17 User image Sergei Dolgov 2005-09-27 00:46:46 PDT
Created attachment 197525 [details] [diff] [review]
Patch - fixes two UTF-8 issues and rounding

Allows UTF-8 font names,
removes assertion for GetTextDimensions (also UTF-8 issue),
removes rounding for system font sizes (fix for menu font size).
Comment 18 User image Sergei Dolgov 2005-09-27 00:50:57 PDT
Actually assertion fix might be in nsRenderingContextBeOS cleanup fix, but anyway.
Tigerdog, you can test this patch for fixing asserion about pageBreaks.
Comment 19 User image Sergei Dolgov 2005-09-27 00:52:06 PDT
Comment on attachment 197525 [details] [diff] [review]
Patch - fixes two UTF-8 issues and rounding

review request.
Comment 20 User image tqh 2005-09-27 04:46:42 PDT
Comment on attachment 197525 [details] [diff] [review]
Patch - fixes two UTF-8 issues and rounding

I'm not sure about the set up of utfpos. If it's less than 1025 it's an array
of 1025 otherwise it's an array of aLength+1. Why not always use aLength+1?

Also I think NS_ConvertUCS2toUTF8 might look better if we use
Comment 21 User image Christian :Biesinger (don't email me, ping me on IRC) 2005-09-27 05:27:01 PDT
Comment on attachment 197525 [details] [diff] [review]
Patch - fixes two UTF-8 issues and rounding

+  NS_ConvertUCS2toUTF8 family(aName);

could you use UTF16 rather than UCS2 here? The UCS2 names are kinda deprecated.
Comment 22 User image Sergei Dolgov 2005-09-27 11:58:56 PDT
Created attachment 197600 [details] [diff] [review]

same as previous but UTF16ToUTF8 used
Comment 24 User image Sergei Dolgov 2005-09-27 12:19:03 PDT
 1.41 <- 1.40
1.54 <- 1.53 
Comment 25 User image Niels Reedijk 2005-09-27 15:27:30 PDT
Comment on attachment 197600 [details] [diff] [review]

BeOS-only change. Won't affect the other platforms. Change is reviewed and
tested, so we would like to have approval to land it in the MOZILLA_1_8_BRANCH
as well.
Comment 26 User image Sergei Dolgov 2005-09-27 15:52:17 PDT
editing description
Comment 27 User image Doug Shelton 2005-09-27 22:25:39 PDT
confirmed - fixes assertions about page breaks
Comment 28 User image tqh 2006-12-27 00:25:16 PST
Comment on attachment 197525 [details] [diff] [review]
Patch - fixes two UTF-8 issues and rounding

removing old review req.

Note You need to log in before you can comment on or make changes to this bug.