Closed
Bug 371504
Opened 18 years ago
Closed 17 years ago
Let OS/2 Thebes display text (using a matched font)
Categories
(Core :: Graphics, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: mozilla, Assigned: mozilla)
References
Details
Attachments
(3 files, 3 obsolete files)
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
image/png
|
Details | |
(deleted),
image/png
|
Details |
The current font handling in the initial checkin for Thebes on OS/2 only displays everything in "System Proportional" (the default GPI font).
I have made some efforts already to make it really use the font that is passed into gfxOS2TextRun::Draw(). I tried two approaches:
- Use the cairo API for drawing (in the code as USE_CAIRO_FOR_DRAWING ifdefs)
I don't think cairo on OS/2 implements everything needed for this approach.
- Use the standard OS/2 GPI calls. This is not in the code yet.
The logfont approach somewhat duplicates the font cache in Thebes, so I
still have to figure out the best way to do this...
Assignee | ||
Comment 1•18 years ago
|
||
Before doing any more work here, I want to see how bug 370588 finally turns out.
Depends on: 370588
Assignee | ||
Comment 2•18 years ago
|
||
Status update: I worked on this today. First it took me a whole day to get building again after bug 370588. Now, AFAIU the main task is now to implement the functions CairoFontFace(), CairoScaledFont(), and SetupCairoFont() as done in gfxWindowsFonts.cpp or similarly in gfxPangoFonts.cpp. I find this awfully difficult, FontConfig is missing functionality that on Linux is substituted by Pango, so I cannot rely on Fc for this task (even if the OS/2 version would be fully operational). And as all this is about selecting fonts to be used in cairo calls and we don't have a native font backend for cairo, I cannot use the OS/2 GPI, either. For now I define dummy properties for the fonts to get building at all, but on startup it crashes somewhere in GKLAYOUT. Probably forgot to set some other important property...
Assignee | ||
Comment 3•18 years ago
|
||
As I am somewhat stuck with this (I got something to complete the build and actually start, but no text ever displayed), I posted a message for help to the newsgroups...
Assignee | ||
Comment 4•18 years ago
|
||
OK, this is how I manage to at least compile Firefox again. It starts, does not crash, but also doesn't show any characters.
Instead of following the approach from gfx/src/os2 this doesn't use the OS/2 GPI functions for font handling, but instead the FreeType library. As that is a prerequisite for building cairo on OS/2 anyway, this doesn't hurt. I am still very unclear about how to do things with FreeType, and especially Fontconfig, so this code just contains dummy values in many functions. But before going any further than this, it would be great to find out why nothing of the text appears on screen...
Assignee | ||
Comment 5•18 years ago
|
||
Hmm, gfxFont.cpp calls cairo_show_glyphs() to draw the characters to the screen. I thought before that the cairo font backend (cairo-ft in our case) would handle that, but that doesn't have a show_glyphs function. And the corresponding cairo function is not defined for the OS/2 backend (the show_glyphs element in the cairo_os2_surface_backend structure is NULL), either. There is some fallback surface that is trying to draw it then, but I don't see how that could work in this case, and obviously it doesn't.
Args, this is again getting a lot more complicated than I thought!
Summary: Let OS/2 Thebes builds use fonts other than the default GPI font → Let OS/2 Thebes display text (using a matched font)
Assignee | ||
Comment 6•17 years ago
|
||
After searching for a fault in cairo for quite a while (writing dedicated OS/2 makefiles and debugging several tests in the process), I managed to find a small problem in the earlier patch (the advance calculation in gfxOS2FontGroup::CreateGlyphRunsFT obviously needs to take into account the width of the character itself, too. ;-) Now, with this patch, I do see characters. And they display _fast_, unlike the demos I showed half a year ago.
It's still ugly, though, doesn't use the correct font etc. My FF build with this patch also crashes quite fast (after a bit of scrolling). Not sure yet why, perhaps it is connected to the GCC upgrade I did just yesterday. If someone still runs the older GCC 3.3.5 and can test this patch, that would be great.
Attachment #261055 -
Attachment is obsolete: true
Comment 7•17 years ago
|
||
I had been asking Doodle about this and while you have found the answer now (about what I was asking anyway) but anyway here was the response... I got another from him where he said that the fonts showed in 1.4.6 too:
------
I've already downloaded the latest Cairo code (1.4.6), and will try to build it at home. Then I'll check if the old testapps and the screen saver modules still work with it. If they do, then the font handling of Cairo/2 is still not broken.
I see that Peter noticed that show_glyphs function of the OS/2 backend is missing and he thinks that this is a problem. Actually it is not a problem, most of the backend functions are optional, if they are implemented then it's good (they should be accelerated then), but if they are not implemented, Cairo has fallback code. So, it should still work.
I don't really understand the problem you have, but as Thebes uses Cairo to draw the text, it means that it has to interpret the fonts using FreeType. FreeType creates the glyphs from the font, and those glyphs will be rendered by Cairo.
How FreeType gets the fonts, and how the list of available fonts is got, it's a different story. On Unix, they use FontConfig to get the list of fonts. FontConfig has a list of the known fonts, has font caches and things like that. On OS/2, I've made that small FontConfig "emulation" stuff, so all this is not needed anymore. This emulation API basically
mimics the FontConfig calls, but only the ones that are used by Cairo. It uses the OS/2 INI file to get the list of available font files and their names. No font cache files, no problems.
So, I'll try to build latest Cairo, check if any modifications in this FC-emulation library is needed, then will check if the font stuffs still work with the new Cairo, and report back.
Meanwhile please tell me where and how I could help!
Bye,
Doodle
Assignee | ||
Comment 8•17 years ago
|
||
With progress on this issue I have surprised myself a bit. With this new patch I can actually load the Wikipedia main page and see German, Arabic, and Hebrew characters. :-) Font substitution for glyphs missing from the font is not included yet, so the Asian characters don't show up.
Changes since the last patch:
- implement proper (?) decoding of UTF-8 characters to 32bit int values
- crashes are mostly gone now (they were due to FT trying to cope with bad
input values)
- implement font matching
There are still lots of XXX in the code but the few problems I see in practise that are related to text:
- system fonts display way too small
- "WarpSans Bold" is queried from the system correctly but appears in
gfxOS2Font only as "WarpSans"
- I think missing glyphs characters (boxes with numbers) are supposed
to show up instead of empty space
I guess these could be delayed to new bugs unless something shows up during review.
Attachment #264620 -
Attachment is obsolete: true
Assignee | ||
Comment 9•17 years ago
|
||
Comment on attachment 264804 [details] [diff] [review]
better version
Vlad, it would be great, if you could take a look at this.
This patch basically throws away the OS/2 specific font code and now uses FreeType + Fontconfig instead, using code from gfxPangoFonts as guideline.
Attachment #264804 -
Flags: review?(vladimir)
Assignee | ||
Comment 10•17 years ago
|
||
Mike should know about this, too. Once this gets into the tree there are some changes to the nightly builds machine to be made.
Comment 11•17 years ago
|
||
(In reply to comment #8)
> Created an attachment (id=264804) [details]
> better version
>
> With progress on this issue I have surprised myself a bit.
Peter, it's nice to see the light at the end of the tunnel.
I tried to build Firefox using this patch but I cannot come across building gfxOS2Fonts.cpp
Here's the start of the error messages:
In file included from E:/usr/src/mozilla/gfx/thebes/src/gfxOS2Fonts.cpp:46:
../../../dist/include/thebes/gfxFont.h:1152: warning: `virtual gfxTextRun*
gfxFontGroup::MakeTextRun(const PRUnichar*, unsigned int, const
gfxTextRunFactory::Parameters*, unsigned int)' was hidden
../../../dist/include/thebes/gfxOS2Fonts.h:86: warning: by `virtual
gfxTextRun* gfxOS2FontGroup::MakeTextRun(const PRUint8*, unsigned int,
gfxTextRunFactory::Parameters*)'
../../../dist/include/thebes/gfxFont.h:1159: warning: `virtual gfxTextRun*
gfxFontGroup::MakeTextRun(const PRUint8*, unsigned int, const
gfxTextRunFactory::Parameters*, unsigned int)' was hidden
../../../dist/include/thebes/gfxOS2Fonts.h:86: warning: by `virtual
gfxTextRun* gfxOS2FontGroup::MakeTextRun(const PRUint8*, unsigned int,
gfxTextRunFactory::Parameters*)'
E:/usr/src/mozilla/gfx/thebes/src/gfxOS2Fonts.cpp: In constructor `
gfxOS2Font::gfxOS2Font(const nsAString_internal&, const gfxFontStyle*)':
E:/usr/src/mozilla/gfx/thebes/src/gfxOS2Fonts.cpp:57: error: class `gfxOS2Font'
does not have any field named `mFontFace'
E:/usr/src/mozilla/gfx/thebes/src/gfxOS2Fonts.cpp:57: error: class `gfxOS2Font'
does not have any field named `mScaledFont'
E:/usr/src/mozilla/gfx/thebes/src/gfxOS2Fonts.cpp: In destructor `virtual
gfxOS2Font::~gfxOS2Font()':
E:/usr/src/mozilla/gfx/thebes/src/gfxOS2Fonts.cpp:71: error: `mFontFace'
undeclared (first use this function)
E:/usr/src/mozilla/gfx/thebes/src/gfxOS2Fonts.cpp:71: error: (Each undeclared
identifier is reported only once for each function it appears in.)
E:/usr/src/mozilla/gfx/thebes/src/gfxOS2Fonts.cpp:74: error: `mScaledFont'
undeclared (first use this function)...
E:/usr/src/mozilla/gfx/thebes/src/gfxOS2Fonts.cpp: In member function `virtual
const gfxFont::Metrics& gfxOS2Font::GetMetrics()':
E:/usr/src/mozilla/gfx/thebes/src/gfxOS2Fonts.cpp:103: error: `FT_UInt'
undeclared (first use this function)
E:/usr/src/mozilla/gfx/thebes/src/gfxOS2Fonts.cpp:103: error: parse error
before `;' token
E:/usr/src/mozilla/gfx/thebes/src/gfxOS2Fonts.cpp:104: error: `FT_Face'
undeclared (first use this function)
E:/usr/src/mozilla/gfx/thebes/src/gfxOS2Fonts.cpp:105: error: `face' undeclared
(first use this function)
E:/usr/src/mozilla/gfx/thebes/src/gfxOS2Fonts.cpp:108: error: `gid' undeclared
(first use this function)
E:/usr/src/mozilla/gfx/thebes/src/gfxOS2Fonts.cpp:108: error: `
FT_Get_Char_Index' undeclared (first use this function)
E:/usr/src/mozilla/gfx/thebes/src/gfxOS2Fonts.cpp:109: error: `FT_LOAD_DEFAULT'
undeclared (first use this function)
E:/usr/src/mozilla/gfx/thebes/src/gfxOS2Fonts.cpp:109: error: `FT_Load_Glyph'
undeclared (first use this function)
E:/usr/src/mozilla/gfx/thebes/src/gfxOS2Fonts.cpp:118: error: `mSpaceGlyph'
many more lines after that
I thought first it failed, because there were several check-ins for thebes after 05/14/2007 but checking out the trunk from 05/13 didn't help. Is there something missing from the patch? For instance, the header files are not part of the patch as in earlier versions...
Assignee | ||
Comment 12•17 years ago
|
||
Comment on attachment 264804 [details] [diff] [review]
better version
Walter, thanks for testing. Indeed I forgot to include the public directory in my diff. I also found a few other smaller problems with it, so I am cancelling the review for now. I should be able to upload a new version later tonight.
Attachment #264804 -
Flags: review?(vladimir)
Assignee | ||
Comment 13•17 years ago
|
||
I still have to cheat with some scaling when computing the metrics but this should now really compile. Some stuff is displayed even nicer than with the old non-cairo rendering because it prefers what the current font has to offer.
Attachment #264804 -
Attachment is obsolete: true
Attachment #265060 -
Flags: review?(vladimir)
Comment on attachment 265060 [details] [diff] [review]
with diffs of the headers, too, this time
Sorry, I'm not the right person to review OS2 font code -- r+ on the makefile changes, at least. If you can't find another OS2 reviewer I'd suggest just checking in as-is without review, since it's not really part of the build.
Attachment #265060 -
Flags: review?(vladimir)
Assignee | ||
Comment 15•17 years ago
|
||
Vlad, I had asked you because the new code doesn't really contain anything OS/2 specific any more. It was adapted from the gfxPangoFonts Xft fast path (which you co-wrote) for the cross-platform Fontconfig + FreeType libraries.
mkaply already said some time ago that I can check "anything" in because all this is overdue work to get OS/2 building again. But I had hoped that even a quick look by somebody who knows about Thebes internals probably uncovers some stupid mistakes.
Comment 16•17 years ago
|
||
Well I built Seamonkey with a pull yesterday and your latest patch. Build went fine.
Seamonkey displays most text as high ascii, lots of accents, overlines etc and is totally unreadable. Testing a couple of sites, most text is as above but some displays perfectly fine. Went to cairographics.org and the transparent pngs displayed fine with no CPU load. The large text NEWS, DOWNLOAD etc displayed fine but nothing else.
Seamonkey also has redrawing problems, needing to be minimized and restored quite often to force a redraw and a wikipedia page just kept flashing.
Still its nice to see progress and a current trunk actually running and hopefully a lot of the problems are fontconfig related.
Assignee | ||
Comment 17•17 years ago
|
||
This is what I see and what I expected everybody else to see. Lots of characters are missing but that is just because the font doesn't contain them. All the characters that are there seem to be correct to me, some are even more correct than in a SeaMonkey from branch that I compare to, e.g. the link to sl.wikipedia.org (where 1.8 branch displays (R) instead of s with an accent). 1.8 branch also uses replacement fonts that have serifs which does not look nice (e.g. for Cyrillic), even though the main font can obviously display them already.
As an ugly workaround until the repaint problem (bug 371505) is solved, resizing the window by a small amount helps...
I will try to package up the current version of the Freetype+Fontconfig library that I use. Perhaps that helps.
Comment 18•17 years ago
|
||
Screenshot of Seamonkey showing strange characters
Assignee | ||
Comment 19•17 years ago
|
||
Hmm, then it takes a lot of effort to read the text. ;-) Let me try to build SeaMonkey, too, although I don't see how that could be different from Firefox in that regard. You could try the new support library:
http://hobbes.nmsu.edu/pub/incoming/mzfntcfgft_20070518.zip
That includes the newest Freetype and an improved version of Netlabs Fontconfig emulation.
Comment 20•17 years ago
|
||
Well I built firefox using the new mzfntcfgft and it is much the same as Seamonkey.
With Seamonkey I went into options and changed the font and all web pages became readable including the options window. Menus etc were still unreadable though. Seems it is the Sans Serif default that doesn't work here as some pages display fine. Also seeing lots of other problems with the widgets. Scroll bar does not change when scrolling, address bar does not update after dragging'n'dropping a page on it. Back and forward buttons do not work.
What is the default font? All these tests are with virgin profiles as Seamonkey kept crashing with my default profile
Assignee | ||
Comment 21•17 years ago
|
||
Ah, of course it is still far from perfect! And as I said, the repaint problems are bug 371505. I cannot solve everything at once... My SeaMonkey (which turned out to be "Suiterunner") displays stuff as nicely as Firefox with a fresh profile.
Btw, the font picked by FC for "sans serif" should be Helvetica, for "serif" you would get Times New Roman. The UI fonts (including the menu font) are supposed to be taken from OS2.INI (PM_Systemfonts), but I am not sure if all those fonts are displayable by cairo through FC+FT.
Comment 22•17 years ago
|
||
My suggestion is to go ahead and check in the code and then we work from there.
Comment 23•17 years ago
|
||
Replying to comment #21
I looked in the ini file and PM_Systemfonts was various 9.Warpsans so I opened up the font editor, installed Alex Taylors Workplace sans (unicode Warpsans lookalike) and alt-drag'n'droped on title bar and menu bar of old regular Seamonkey that I've been running. Started up the new Firefox and Menus and title bar displayed fine but not Web pages.
I then moved helv*.ofm out of \psfonts, restarted Firefox and the Wikipedia page is displaying fine. The URL entry form and search form are still messed up.
I'd say from now on Mozilla apps may only work with truetype fonts
Assignee | ||
Comment 24•17 years ago
|
||
(In reply to comment #23)
> I'd say from now on Mozilla apps may only work with truetype fonts
FT functions should work fine for Type 1 fonts, too. But WarpSans may indeed be a problem. I don't even know in which file to look for that. I guess in later stages we could try to paint the text in the chrome (i.e. the text using system fonts) using OS/2 GPI while the webpage is painted through cairo.
(In reply to comment #22)
> My suggestion is to go ahead and check in the code and then we work from there.
OK, will do that.
Assignee | ||
Comment 25•17 years ago
|
||
Patch checked into trunk. Will open some follow-up bugs.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Comment 26•17 years ago
|
||
(replying to comment #24)
WarpSans is in DSPRES.DLL.
You need to log in
before you can comment on or make changes to this bug.
Description
•