Closed
Bug 364713
Opened 18 years ago
Closed 17 years ago
[Cairo][regression] bold and italic not simulated for families that lack bold and/or italic faces
Categories
(Core :: Graphics, defect, P2)
Tracking
()
VERIFIED
FIXED
People
(Reporter: suishouen, Assigned: jtd)
References
Details
(Keywords: jp-critical, regression)
Attachments
(26 files, 20 obsolete files)
2.56 KB,
text/html; charset=shift-jis
|
Details | |
1.20 KB,
text/html
|
Details | |
10.82 KB,
image/png
|
Details | |
101.61 KB,
image/png
|
Details | |
28.39 KB,
image/png
|
Details | |
112.31 KB,
image/png
|
Details | |
408 bytes,
text/html
|
Details | |
45.55 KB,
image/png
|
Details | |
140.90 KB,
image/png
|
Details | |
147.27 KB,
image/png
|
Details | |
124.89 KB,
image/png
|
Details | |
220.16 KB,
image/png
|
Details | |
80.76 KB,
image/png
|
Details | |
4.57 KB,
text/html
|
Details | |
2.16 KB,
text/html
|
Details | |
132.15 KB,
image/png
|
Details | |
27.97 KB,
image/png
|
Details | |
2.30 KB,
text/html
|
Details | |
127.61 KB,
image/png
|
Details | |
2.46 KB,
image/svg+xml
|
Details | |
6.14 KB,
image/svg+xml
|
Details | |
64.18 KB,
image/png
|
Details | |
28.42 KB,
patch
|
vlad
:
review+
|
Details | Diff | Splinter Review |
183.78 KB,
image/png
|
Details | |
4.26 KB,
text/html
|
Details | |
34.32 KB,
patch
|
pavlov
:
review+
pavlov
:
superreview+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en; rv:1.9a2pre) Gecko/20061221 Camino/1.2+
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en; rv:1.9a2pre) Gecko/20061221 Camino/1.2+
Bold & Strong are displayed as fixed-font in Japanese.
Reproducible: Always
Test case coming soon.
Version 2006122202 (1.2+) fixed the problem that I said above, but <Bold> & <Strong> aren't displayed correctly, so change the Summary.
Summary: [Cairo][regression] Bold & Strong are displayed as fixed-font in Japanese → [Cairo][regression] Bold & Strong aren't displayed correctly in Japanese
Comment 6•18 years ago
|
||
Is this really Camino-only, or is it a core bug that shows up in trunk Firefox as well?
It reproduced.
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.9a2pre) Gecko/20061222 Minefield/3.0a2pre
(In reply to comment #1)
> Created an attachment (id=249429) [edit]
> Test Case
>
In the font specification of this test case, the problem did not reproduce.
But the problem reproduced similarly when Japanese was included in this test case
specifying it.
And the treatment of a Japanese font is not perfect yet. (bug362665)
I'm not sure if this might be bug 364678 or something else, so kicking to gfx:thebes but not confirming (someone who has a better clue, please confirm and have block the right bugs if warranted)....
Component: General → GFX: Thebes
Keywords: regression
Product: Camino → Core
QA Contact: general → thebes
Version: unspecified → Trunk
Comment 10•18 years ago
|
||
Comment 11•18 years ago
|
||
Comment 12•18 years ago
|
||
Comment 13•18 years ago
|
||
The display of the font is almost the same as the application for other Mac according to bug362665.
Because "hiragino kaku go" and "hiragino min cyou" have the bold font, the bold display is an expectation.
Reporter | ||
Comment 14•18 years ago
|
||
I set to use "Sans-serif" "Osaka" for the default font, but it doesn't seem to work.
Japanese fonts are displayed as "Hiragino Mincho".
Reporter | ||
Comment 15•18 years ago
|
||
Screen shot of <http://www.starfleet.ac/~inu/link/>
Comment 16•18 years ago
|
||
This is one of the issues from bug 362665. I build Minefield with the patch (v2.01) from bug 364678, and that fixes most issues.
Depends on: 364678
Reporter | ||
Comment 17•18 years ago
|
||
So is this a duplicate of bug 364678?
Comment 18•18 years ago
|
||
confirming.
But your testcase is invalid...
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 19•18 years ago
|
||
Use this for valid HTML.
# But Safari doesn't work fine in this. The Safari cannot resolve the font families correctly. See this testcase with old gfx(e.g., fx2).
Attachment #249429 -
Attachment is obsolete: true
Attachment #249440 -
Attachment is obsolete: true
Attachment #249441 -
Attachment is obsolete: true
Attachment #249470 -
Attachment is obsolete: true
Attachment #249474 -
Attachment is obsolete: true
Attachment #249475 -
Attachment is obsolete: true
Attachment #249476 -
Attachment is obsolete: true
Attachment #249480 -
Attachment is obsolete: true
Comment 20•18 years ago
|
||
We can reproduce this bug with italic style too.
If the font family doesn't have the style, current cairo doesn't generate the style dynamically. See http://lxr.mozilla.org/mozilla/source/gfx/cairo/cairo/src/cairo-atsui-font.c#711
> 711 /* TODO - bold and italic text
> 712 *
> 713 * We could draw the text using ATSUI and get bold, italics
> 714 * etc. for free, but ATSUI does a lot of text layout work
> 715 * that we don't really need...
> 716 */
Vlad:
Should we change the cairo ourselves? I cannot find the bug in the bugzilla of cairo.
Keywords: jp-critical
Summary: [Cairo][regression] Bold & Strong aren't displayed correctly in Japanese → [Cairo][regression] Bold & italic aren't displayed correctly if the font doesn't have the style(e.g., CJK fonts are not have the styles)
Updated•18 years ago
|
Summary: [Cairo][regression] Bold & italic aren't displayed correctly if the font doesn't have the style(e.g., CJK fonts are not have the styles) → [Cairo][regression] Bold & italic aren't displayed correctly if the font doesn't have the style(e.g., CJK fonts don't have the styles)
Comment 21•18 years ago
|
||
(In reply to comment #19)
> Use this for valid HTML.
> # But Safari doesn't work fine in this. The Safari cannot resolve the font
> families correctly. See this testcase with old gfx(e.g., fx2).
>
It is more difficult...
Safari (cocoa app) need 'Hiragino Kaku Gothic Pro' (or Hiragino Mincho Pro for serif), Carbon based apps that use Atsui need ヒラギノ明朝 Pro or ヒラギノ角ゴ Pro ( full name according to FontBook.app - one can omit the W3 or W6): Opera 9, iCab 3.0. The same name is needed for old Gecko (using QuickDraw).
I noticed earlier on my Minefield build with the patch for bug 364678 that Gecko+Cairo only will recognise the Hiragino font in a stylesheet if I use the postscript name for Hiragino Mincho (HiraMinPro). I'll attach a test case next.
Comment 22•18 years ago
|
||
The green paragraph is not displayed as Mincho (serif).
Updated•18 years ago
|
Attachment #249494 -
Attachment mime type: text/html → text/html; charset=shift-jis
(In reply to comment #20)
> We can reproduce this bug with italic style too.
>
> If the font family doesn't have the style, current cairo doesn't generate the
> style dynamically. See
> http://lxr.mozilla.org/mozilla/source/gfx/cairo/cairo/src/cairo-atsui-font.c#711
>
> > 711 /* TODO - bold and italic text
> > 712 *
> > 713 * We could draw the text using ATSUI and get bold, italics
> > 714 * etc. for free, but ATSUI does a lot of text layout work
> > 715 * that we don't really need...
> > 716 */
>
> Vlad:
>
> Should we change the cairo ourselves? I cannot find the bug in the bugzilla of
> cairo.
I'm not sure what you mean; cairo isn't involved at all in our text layout/font selection. We just give it a font id and a set of glyphs. Synthesizing italic and the like from this would be pretty hard; I don't even know if ATSU can synthasize oblique and bold. We should do more investigation, I guess...
Comment 24•18 years ago
|
||
(In reply to comment #23)
> I'm not sure what you mean; cairo isn't involved at all in our text layout/font
> selection. We just give it a font id and a set of glyphs. Synthesizing italic
> and the like from this would be pretty hard; I don't even know if ATSU can
> synthasize oblique and bold. We should do more investigation, I guess...
The ATSU generates the bold/italic style if the font family doesn't have the bolder/italic style. The comment in cairo says it too. So, we need to send the style which we want. And cairo should honor the style. But there are 2 problem:
1. We cannot send the style to cairo.
2. Cairo is not using ATSU and is not generate the styles.
If cairo doesn't implement it until Fx3, this is a very big bug of Fx3 for CJK users... Therefore, we need to contact to the developers of cairo. But this bug is not filed in their bugzilla.
Comment 25•18 years ago
|
||
FYI.
http://www.devworld.apple.com/documentation/Carbon/Reference/ATSUI_Reference/Reference/reference.html#//apple_ref/doc/c_ref/kATSUQDBoldfaceTag
> Specifies a boldface text style. Text style attribute tags are included for compatibility with the Style type used by the QuickDraw function TextFace. If a font variant for this text style exists, ATSUI uses that variant. Otherwise, the variant is generated algorithmically. The associated value is of type Boolean and has a default value of false.
http://www.devworld.apple.com/documentation/Carbon/Reference/ATSUI_Reference/Reference/reference.html#//apple_ref/doc/c_ref/kATSUQDItalicTag
> Specifies an italic text style. Text style attribute tags are included for compatibility with the Style type used by the QuickDraw function TextFace. If a font variant for this text style exists, ATSUI uses that variant. Otherwise, the variant is generated. The associated value is of type Boolean and has a default value of false.
Comment 26•18 years ago
|
||
fwiw i'm seeing the same,
"but <Bold> & <Strong> aren't displayed correctly"
in,
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.9a2pre) Gecko/2007012104 Minefield/3.0a2pre
the problem manifests on GMail screens ... but on other sites, bold/strong display correctly. iiuc, it's a matter of which font is displayed.
Flags: blocking1.9? → blocking1.9+
Target Milestone: --- → mozilla1.9alpha6
Comment 28•18 years ago
|
||
Commenting from the cairo side... atsu will generate synthetic bold and italic for you (among other things) but its not as simple as passing the ATSUStyle along with the glyphs - the ATSU rendering functions that are capable of synthesis expect a textrun as input, not glyphs; it'd need changes in the public API of cairo.
Synthetic bold, condensed and oblique (ie italic) are just matrix transforms though. It should be possible to achieve the desired effect by setting the font matrix?
http://www.cairographics.org/manual/cairo-Text.html#cairo-set-font-matrix
Synthetic bold generated this way is pretty ugly. The other way people achieve the effect, at smaller point sizes, is to render the same text again shifted one pixel.
Comment 29•17 years ago
|
||
punting remaining a6 bugs to b1, all of these shipped in a5, so we're at least no worse off by doing so.
Target Milestone: mozilla1.9alpha6 → mozilla1.9beta1
Updated•17 years ago
|
Status: NEW → ASSIGNED
Updated•17 years ago
|
Assignee: nobody → masmullin
Status: ASSIGNED → NEW
Updated•17 years ago
|
Priority: -- → P3
Target Milestone: mozilla1.9 M8 → ---
Assignee | ||
Comment 33•17 years ago
|
||
I'm going to grab this, I think it is possibly related to some bugs I'm looking at now. Scream if you're already investigating a solution for this.
Assignee: masmullin → jdaggett
Comment 34•17 years ago
|
||
Hi John
Im hoping we can collaborate on this bug, as I have been working on it for a class I am doing. I am brand spanking new to Mozilla code which is why I am so slow, but I do have some patches which help me in the debugging process, and will probably help others.
From my newbie perspective there are three options:
1) dont use cairo for rendering text (probably a heck of a lot of work)
and do ATSU text rendering ourselves
2) do work on cairo so that cairo renders ATSU (also a heck of a lot of work, but the best choice)
3) fake it with synthetic fonts. (I think its a bad choice, but easier)
Assignee | ||
Updated•17 years ago
|
Assignee: jdaggett → masmullin
Assignee | ||
Comment 35•17 years ago
|
||
Using the testcase from 396083, rendered in Webkit latest build.
The top shows font-weight: 500, the bottom shows font-weight: 600. On the screen weight 600 clearly seems "bolder" but this is simulated by drawing each glyph twice, the second time with a one pixel offset.
Assignee | ||
Comment 36•17 years ago
|
||
In FF2 we generated synthetic bold for weights 700 and higher. Opera doesn't appear to do synthetic bolding.
Assignee | ||
Comment 37•17 years ago
|
||
I dug around in FF1.5 and Webkit code to find the pertinent tidbits of source.
Webkit does synthetic bolding by drawing text twice, the second time with a one pixel offset.
http://trac.webkit.org/projects/webkit/browser/trunk/WebCore/platform/mac/FontDataMac.mm#L107
Oblique is done by drawing with a 14deg shear specified in the text transform:
http://trac.webkit.org/projects/webkit/browser/trunk/WebCore/platform/mac/FontMac.mm#L119
In the FF 1.5 code it looks like we relied on the ability of QD to produce a synthetic bold font. I think this is the code, I haven't tested to verify that this is the actual rendering path as there appear to be lots of DrawString methods floating around:
Requesting bold/italic fonts from ATSUI:
http://lxr.mozilla.org/mozilla1.7/source/gfx/src/mac/nsATSUIUtils.cpp#257
I would say the next step here is to write a small piece of test code that renders text in the same way as FF 1.5/2.0, using a font like Futura that doesn't have a bold face. (Note: double check this in FontBook if you've installed your own fonts or have apps that came with extra fonts). Use Pixie if you need to get a close up, pixel-level view of the rendering.
Once we know exactly how we did synthetic bold before, we can figure out a way to add that in with the current code. I think this is preferable compared to asking ATSUI to do the same thing for us, since we'll be able to make that work the same way when we move to CoreText in the future.
Comment 38•17 years ago
|
||
(In reply to comment #36)
>
> In FF2 we generated synthetic bold for weights 700 and higher. Opera doesn't
> appear to do synthetic bolding.
Fwiw:
1. Opera 9.5 alpha now does synthetic bolding for Futura (and some other fonts, when no real bold is available)
2. FF2 was wrong regarding bold and font-weight 700. That was changed for Gecko 1.9, see
https://bugzilla.mozilla.org/show_bug.cgi?id=365613#c8
Assignee | ||
Comment 39•17 years ago
|
||
Looks like Opera 9.5 does synthetic bolding by using a text transform with a slight xscale, something like 1.03. Ick, doesn't look so great.
Comment 40•17 years ago
|
||
This is a patch which has helped me understand the way fonts are rendered in trunk. Its very dirty and just meant as an example of synthetic italics.
Comment 41•17 years ago
|
||
(In reply to comment #40)
> Created an attachment (id=285962) [details]
> Example of synthetic italics
>
> This is a patch which has helped me understand the way fonts are rendered in
> trunk. Its very dirty and just meant as an example of synthetic italics.
>
You should be able to get this effect without adding new public api - just call cairo_set_font_matrix().
Comment 42•17 years ago
|
||
I have been working on getting a text rendering with ATSUI. I've managed to get text rendering with bold/italic however the layout is all screwed up. I would like someone with more knowledge to take a look if they have the time please.
Comment 43•17 years ago
|
||
This is the results from rendering one of my slightly edited test cases. It shows the bolding/italicizing which is going on.
Comment 44•17 years ago
|
||
Comment on attachment 289046 [details] [diff] [review]
Please look at me: I am ATSUI
Hi, can you check this out? I am trying to get ATSUI to do the work here. Layout is bad, but thats why I am looking for help
Attachment #289046 -
Flags: review?(jdaggett)
Comment 45•17 years ago
|
||
Thank you, Michael.
And you should read our coding rules:
http://developer.mozilla.org/en/docs/Mozilla_Coding_Style_Guide
your if statement should be changed.
Assignee | ||
Comment 46•17 years ago
|
||
Mike, you should probably have Vlad take a look at this but off the top of my head I don't think creating ATSULayout objects for each text run is going to work performance wise. We need to push this down into cairo somehow. Also, the synthetic oblique is in the wrong direction.
Comment 47•17 years ago
|
||
Possible fix for italic/oblique/bold problems.
Attachment #285962 -
Attachment is obsolete: true
Attachment #289046 -
Attachment is obsolete: true
Attachment #289046 -
Flags: review?(jdaggett)
Assignee | ||
Comment 49•17 years ago
|
||
This patch (292539) looks like it's headed in the right direction. Could you post what the results look like? How does using the size matrix for bolding look at both small and large text sizes?
Comment 52•17 years ago
|
||
Is bug 409680 actually a duplicate of this? It involves fonts that *do* have an actual bold-italic version not rendering correctly, rather than synthesized bold and italic.
Comment 53•17 years ago
|
||
Sorry to bother you but I don't understand why bug 409680 has been marked as a duplicate of this bug: as far as I know Arial (see last test case) has the styles for bold and italic.
Maybe the description of this bug should be changed to avoid other duplicates? Or 409680 wasn't a duplicate?
Comment 55•17 years ago
|
||
This also affects the display of away states in the ChatZilla user list :-(
Comment 56•17 years ago
|
||
jdaggett: mmullin is back in school, I believe, so you probably want to spin a build yourself (try server?) to get examples of output.
Assignee | ||
Comment 57•17 years ago
|
||
(In reply to comment #56)
> jdaggett: mmullin is back in school, I believe, so you probably want to spin a
> build yourself (try server?) to get examples of output.
OK, I'm gonna grab this, although I won't be able to look at it until post-B3 freeze.
Assignee: masmullin → jdaggett
Assignee | ||
Updated•17 years ago
|
Status: NEW → ASSIGNED
Summary: [Cairo][regression] Bold & italic aren't displayed correctly if the font doesn't have the style(e.g., CJK fonts don't have the styles) → [Cairo][regression] bold and italic not simulated for families that lack bold and/or italic faces
Comment 59•17 years ago
|
||
I have the following behaviour:
Specifying a *size* (any size) for the font makes it not display the italics: http://pastebin.ca/918322 , but leaving out the size shows italics fine. (Bold works in both cases.)
This is OS X 10.4 with the sans-serif font set to Helvetica.
Is this the same bug, or should I file a new one?
Assignee | ||
Comment 60•17 years ago
|
||
(In reply to comment #59)
> I have the following behaviour:
> Specifying a *size* (any size) for the font makes it not display the italics:
> http://pastebin.ca/918322 , but leaving out the size shows italics fine. (Bold
> works in both cases.)
>
> This is OS X 10.4 with the sans-serif font set to Helvetica.
>
> Is this the same bug, or should I file a new one?
Assuming you're using a recent build of Firefox 3, yes, this is the same bug. Helvetica has no italic face (use FontBook to confirm). If you can come up with a testcase that shows italic where the font is Helvetica, please post it along with a screenshot and build version info. Thanks!
Comment 61•17 years ago
|
||
Yes, I'm using Firefox 3 Beta 3 (I should have mentioned). Helvetica does have an italic face, Helvetica Oblique [ #395886 and #396002 but you know about it already :) ]. I do not understand why specifying the font size in the CSS should affect it, it's presumably the same font. (But it does, see comment/pastebin.) But if you say so, it must be the same bug, consider my example as one more testcase to help with the debugging, then :)
Updated•17 years ago
|
Flags: tracking1.9+ → blocking1.9+
Priority: P3 → P2
Assignee | ||
Comment 62•17 years ago
|
||
Assignee | ||
Comment 64•17 years ago
|
||
Simplified a bit. Both bold and oblique are done by swizzling the font matrix. Need to do the correct weight calculation (e.g. 898).
Attachment #306445 -
Attachment is obsolete: true
Assignee | ||
Updated•17 years ago
|
Attachment #306445 -
Attachment is obsolete: false
Assignee | ||
Updated•17 years ago
|
Attachment #292539 -
Attachment is obsolete: true
Comment 65•17 years ago
|
||
(In reply to comment #64)
> Created an attachment (id=306456) [details]
> patch, v.0.2, update of mmullin patch
>
> Simplified a bit. Both bold and oblique are done by swizzling the font matrix.
> Need to do the correct weight calculation (e.g. 898).
That work pretty well, so far. On 10.5.2.
BUT
font-weight:lighter; gives very weird results: slanting/italicizing the text for all fonts.
[hmm, and Helvetica Neue doesn't show font-weight:100 correctly (Ultra-light face not used) - but that doesn't seem a regression form this patch, maybe something from bug 411891, I never really tested that one since you fixed it].
Comment 66•17 years ago
|
||
from testcase attachment.cgi?id=297512 in bug 411891.
(in the same testcase, you can see that Helvetica Neue, font-weight 100; is not correct on 10.5.2)
Assignee | ||
Comment 67•17 years ago
|
||
(In reply to comment #65)
> That work pretty well, so far. On 10.5.2. BUT
> font-weight:lighter; gives very weird results: slanting/italicizing the text
> for all fonts.
Yeah, I'm seeing that also on 10.4, I'm debugging that now.
> [hmm, and Helvetica Neue doesn't show font-weight:100 correctly (Ultra-light
> face not used) - but that doesn't seem a regression form this patch, maybe
> something from bug 411891, I never really tested that one since you fixed it].
I'll check this.
Assignee | ||
Comment 68•17 years ago
|
||
Comment 69•17 years ago
|
||
John, I saw another combination, same issue:
<p class="headline"><strong><a href>xxx</a>
.headline {font-weight:bold; /* other rules */}
(Geneva is the used font, according to Firebug)
on http://www.japantimes.co.jp/
towards the top, a grey box on the right (Editor's choice).
Assignee | ||
Comment 70•17 years ago
|
||
Fixup tiny js error!
Attachment #306990 -
Attachment is obsolete: true
Assignee | ||
Comment 71•17 years ago
|
||
This is probably closer to what mmullin intended, synthetic oblique is done with an x-skew, bolding is done with an x-scale. The obliquing seems fine, the bold doesn't look bold, just expanded.
Two other ways:
1. double-striking (WebKit does this)
2. adding a stroke width (example of this included in Apple dev examples)
Handling lighter/bolder is a bit tricky with this code, there are times when it's hard to decide whether to bold or not. For example, with a font family containing faces with weights 100, 400 only, a style weight of 101 should not be bold but a style weight of 102 should be (these correspond to nested elements with 'bolder' applied). Probably not a common occurance but something to consider for fun and amusement...
Attachment #306456 -
Attachment is obsolete: true
Assignee | ||
Updated•17 years ago
|
Attachment #306993 -
Attachment is patch: true
Attachment #306993 -
Attachment mime type: application/octet-stream → text/plain
Assignee | ||
Comment 72•17 years ago
|
||
Assignee | ||
Comment 73•17 years ago
|
||
Comment 74•17 years ago
|
||
Gecko is on the left, WebKit on the right.
With patch v.0.3, the artificial bolding causes the textrun to overflow/run out of its bounding box. Look at the underline (text-decoration) or the background on the italic lines.
Geneva is used in the screenshot, but any font that needs artificial bolding is affected.
The italics look good for most fonts I could test. The bold is a bit too light.
Assignee | ||
Comment 75•17 years ago
|
||
Italic via cairo font matrix, bold by drawing glyphs a second time with a one-pixel offset. Still need to figure out how to adjust bounding box and catch the case where an RGBA color with A != 1 is involved.
Attachment #306993 -
Attachment is obsolete: true
Assignee | ||
Comment 76•17 years ago
|
||
Safari adds a per-character 1-pixel advance, I don't think that's needed.
Assignee | ||
Comment 77•17 years ago
|
||
FF3 (top left) and FF2 (top right) display is hard to read, Safari (bottom) is readable. Probably need to consider adding advance at smaller sizes, argh.
Assignee | ||
Comment 78•17 years ago
|
||
Attachment #306992 -
Attachment is obsolete: true
Assignee | ||
Comment 79•17 years ago
|
||
Uses canvas mozText to draw a text with different hsla colors. Fonts used are Futura (no bold face), Hiragino Maru Gothic Pro (no bold face), Helvetica Neue (has bold face).
With the latest patch (v.0.4), text changes color when bolded. Scroll down to the section for alpha = 0.4 to see this more clearly.
Assignee | ||
Comment 80•17 years ago
|
||
Assignee | ||
Comment 81•17 years ago
|
||
Shows text with and without bolding. Fonts are Futura, Hiragino Maru Gothic Pro and Helvetica Neue, from left to right.
Comment 82•17 years ago
|
||
(In reply to comment #79)
> Created an attachment (id=307856) [details]
> testcase, synthetic bolding with hsla colored text
>
> Uses canvas mozText to draw a text with different hsla colors. Fonts used are
> Futura (no bold face), Hiragino Maru Gothic Pro (no bold face), Helvetica Neue
> (has bold face).
>
> With the latest patch (v.0.4), text changes color when bolded. Scroll down to
> the section for alpha = 0.4 to see this more clearly.
>
Fwiw, WebKit (latest build) does the same: bolded text is darker than the non-bold text.
(I had to make a static test file, WebKit doesn't like your canvas testcase).
My (Camino) build with patch v.0.4 works pretty well BTW
Are we doing the fake-bold or is atsui? That's fine for now, though it should be an easy fix -- we just need to recognize if we're doing fake bold, and if so, draw without alpha into a surface group/layer and composite with the appropriate alpha. I'd file a separate bug on that for fixing in 1.9.0.x.
Assignee | ||
Comment 84•17 years ago
|
||
Handle alpha-colored text by buffering all drawing, drawing with solid color and compositing the result using the alpha value.
Vlad, could you look this over quickly? I just want to verify that this looks like it's on the right path...
Still need to adjust metrics ever so slightly in the bold case. Not sure anything is needed in the oblique case, although it might be possible for trailing glyphs to exceed the bounds box.
Attachment #307193 -
Attachment is obsolete: true
Attachment #307904 -
Flags: review?(vladimir)
Assignee | ||
Comment 85•17 years ago
|
||
argh, fix typo
Attachment #307904 -
Attachment is obsolete: true
Attachment #307906 -
Flags: review?(vladimir)
Attachment #307904 -
Flags: review?(vladimir)
Assignee | ||
Comment 86•17 years ago
|
||
Assignee | ||
Comment 87•17 years ago
|
||
"Basically" correct, I'm seeing off-by-1 differences in the RGB values (color with alpha vs. opacity blit path differences)
I'm not super excited by using a helper object here, given that it's in a critical path. Instead of doing the work in the helper object's constructor/destructor, maybe add Init() and Flush() methods, and do the opaque color source check in the Draw method? That way you could just avoid calling Init() entirely; same thing with Flush(). (Flush() in general would be better -- you don't really want to do drawing from a destructor.) One thing is that I'm pretty sure subpixel AA will be wrong for this case, but I'm not sure if subpixel AA ever comes into play for non-opaque text anyway on the mac.
Comment 89•17 years ago
|
||
John-san:
Should you modify the widths of each bolden glyphs?
Assignee | ||
Comment 90•17 years ago
|
||
Wee, pretty sprial...
The first part of each phrase is bolded, the second half is not. Colors should not change within a phrase when switching from bold to regular.
Assignee | ||
Comment 91•17 years ago
|
||
Based on Vlad's comments, restructured code, it's probably a bit simpler now, the functionality is the same as the last patch.
Testing with text on a path in SVG, the code draws correctly but it's slow as mud. The code in nsSVGGlyphFrame::LoopCharacters calls the textrun Draw method one character at a time without a dirty rect, pigfart. This means the code is drawing into a buffer the size of the frame and compositing it in *every single character*!! Need to add in code to calculate extents.
Attachment #307906 -
Attachment is obsolete: true
Attachment #307906 -
Flags: review?(vladimir)
Should the SVG text-along-a-path code handle transparent colors itself, by pushing a group for the whole string? What is the defined rendering for self-intersecting text-on-path?
For that matter, what is the defined rendering for SVG text with explicit glyph positions where the glyphs overlap one another?
Assignee | ||
Comment 94•17 years ago
|
||
(In reply to comment #92)
> Should the SVG text-along-a-path code handle transparent colors itself, by
> pushing a group for the whole string? What is the defined rendering for
> self-intersecting text-on-path?
Seems like it should be consistent with self-intersecting paths, which draw with a single color for the entire path. Text along a path draws each glyph as if it was a seperate object, intersections between glyphs or self-intersections cause double blending to occur.
Assignee | ||
Comment 95•17 years ago
|
||
OK, what about self-intersecting text containing a span in a different color with a different opacity level? :-)
Comment 99•17 years ago
|
||
(In reply to comment #97)
> *** Bug 422143 has been marked as a duplicate of this bug. ***
>
As discussed in that page, italics do not display in OS/X (at least 10.4) on WikiMedia style sheets. That is, they display upright. For example, from WikiPedia:
http://en.wikipedia.org/wiki/User:TedPavlic/Sandbox/Firefox3Beta3and4ItalicsTest
You can find that style sheet at:
http://en.wikipedia.org/wiki/MediaWiki:Common.css
Comment 100•17 years ago
|
||
> You can find that style sheet at:
>
> http://en.wikipedia.org/wiki/MediaWiki:Common.css
Changing the Sans-serif font from the default "Helvetica" to "Helvetica Neue" (which has italics) fixes the problem.
Assignee | ||
Comment 101•17 years ago
|
||
This should be fairly close to the final patch. I still need to figure out how to adjust the width of the text run, since double-striking will draw 1-pixel beyond the extents of the non-bolded text.
In this version, a boolean is passed around when selecting weights to identify relative weights (bolder/lighter) couldn't be completely resolved with the existing font faces. This makes bolder/lighter handling consistent, no matter what the assortment of weights available are.
Vlad, let me know if you think the code in gfxTextRun::Draw looks ok.
Attachment #308381 -
Attachment is obsolete: true
Attachment #309067 -
Flags: review?(vladimir)
Comment on attachment 309067 [details] [diff] [review]
patch, v.0.9, bolding via double strike
Yep, looks fine.
Attachment #309067 -
Flags: review?(vladimir) → review+
Assignee | ||
Comment 103•17 years ago
|
||
When bolding by drawing text twice, at larger sizes (>36pt) the bolding is hard to distinguish from non-bolded text. Masayaki and Simon mentioned on IRC that it might be better to draw with a two-pixel offset at larger sizes. This screenshot shows the problem with doing this, the two-pixel offset introduces nasty artifacts at sharply mitred inflection points, the "w" in weight for Futura, or the "c" for Futura or Gothic-style faces for Japanese text. It also results in an ugly balance within the ukanmuri radical at the top of the third character in "tonari no kyaku", the horizontal line is distinctly thinner than the short vertical segments at either end.
If we want to do triple-striking for larger sizes, that might be one way to work around the artifacts problem but in general I think it's better not to go too crazy trying to simulate boldness, both for performance reasons and because we really don't want to be ruining the efforts of font designers who spent a lot of time carefully designing the balance of their letterforms.
Assignee | ||
Comment 104•17 years ago
|
||
Since we've decided to alter the advances in the synthetic bolding case, need to be sure to test with lots of different scripts.
Assignee | ||
Comment 105•17 years ago
|
||
Synthetic bolding and obliqueing on the mac
- obliqueing by skewing via the font matrix (note bug 423607)
- bolding by double-striking with a 1px offset
- bolding occurs at weights 600 and greater
- bolder causes synthetic bolding beyond the boldest face available, no matter what the weight of that face
- lighter always disables synthetic bolding
- advance is increased by 1px at cluster/lig boundaries
- alpha colors render at the same color via buffered render
- at larger text sizes, bolding is very subtle
- tested 2px offset for larger sizes, rejected
- bolding for stroked text via SVG ignored (gfxTextRun::DrawToPath)
- tested with Japanese, Arabic, Devanagari, Thai, Hebrew, Korean, Chinese
Attachment #310245 -
Flags: superreview?(pavlov)
Attachment #310245 -
Flags: review?(roc)
Comment 106•17 years ago
|
||
I just tried the patch - maybe I am wrong or missing something - but isn't the synthetic italic meant to lean the opposite way? What I see is the text leaning to the left. For normal italic fonts text leans to the right.
Adil, that's the bug referenced in comment 105:
> - obliqueing by skewing via the font matrix (note bug 423607)
Comment 108•17 years ago
|
||
Aha - I was missing something. One interesting side effect though - The italic for the Arabic looks much better with the italic angle to the left. I suppose that should go into a different bug report though.
Assignee | ||
Comment 109•17 years ago
|
||
(In reply to comment #105)
> Created an attachment (id=310245) [details]
> patch, v.1.0, bolding via double strike with advance
oops, left in a printf in gfxFont::Draw, will remove this in the final checkin
Assignee | ||
Comment 110•17 years ago
|
||
Together with Vlad, we decided that cairo is doing the right thing so i switched the sign of the skew factor so that synthetic italics lean right.
Attachment #310245 -
Attachment is obsolete: true
Attachment #310409 -
Flags: superreview?(pavlov)
Attachment #310409 -
Flags: review?(pavlov)
Attachment #310245 -
Flags: superreview?(pavlov)
Attachment #310245 -
Flags: review?(roc)
Updated•17 years ago
|
Attachment #310409 -
Flags: superreview?(pavlov)
Attachment #310409 -
Flags: superreview+
Attachment #310409 -
Flags: review?(pavlov)
Attachment #310409 -
Flags: review+
Assignee | ||
Comment 112•17 years ago
|
||
checked in yesterday. confirmed duplicates.
This will be part of B5, yay!
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Comment 113•17 years ago
|
||
Thanks John !
It works nicely.
Reporter | ||
Comment 114•17 years ago
|
||
John, thanks a lot for your hard work.
Comment 115•17 years ago
|
||
Verified fixed with Camino trunk 2008032100. Thanks a bunch, John. I can finally use Wikipedia again without being horribly confused :)
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•