Looking for saved searches? click on "Search Bugs" above.

Use Pango for printing

RESOLVED INCOMPLETE

Status

Core Graveyard
GFX: Gtk
RESOLVED INCOMPLETE
11 years ago
7 years ago

People

(Reporter: Behdad Esfahbod, Unassigned)

Tracking

1.8 Branch
mozilla1.8.1
x86
Linux

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 1 obsolete attachment)

(Reporter)

Description

11 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.13) Gecko/20060501 Epiphany/2.14
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.13) Gecko/20060501 Epiphany/2.14

Attaching patch that makes firefox make use of Pango for printing whenever it's using it for text rendering.  This makes it possible to print Indic for example.  It also prints bitmap fonts by tracing them (one square per pixel!).

As a bonus, I've made it to print MathML too!

Downstream Red Hat bug is:

  https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=182533

And sample output can be found at:

  http://www.gnome.org/~behdad/FirefoxPangoPrinting/


Basically what I have done:

  * copied nsFontExtentsPango.{cpp,h} and mozilla-decoder.[ch] from gfx/src/gtk into gfx/src/ps and rename them appropriately.

  * Change nsFontExtentsPSPango to work with a nsRenderingContextPS instead of nsRenderingContextGTK, and to implement a PangoRenderer to generate PS output.

  * Move DrawString, GetTextDimensions, and GetBoundingMetrics implementations from nsRenderingContextPS to nsFontExtentsPS and make the rendering context delegate to the nsFontExtentsPS.
 
  * Change nsDeviceContextPS to instantiate nsFontExtentsPSPango instead of nsFontExtentsPS if Pango text rendering is enabled at run-time.

  * Change nsPostScriptObject to use accept glyphs instead of characters, and to generate output from a PangoGlyphString object.

Reproducible: Always
(Reporter)

Comment 1

11 years ago
Created attachment 243261 [details] [diff] [review]
the patch
Created attachment 243837 [details] [diff] [review]
Patch used in FC6

Differences to the previous patch:
- Wrap impl of GetBoundingMetrics around #ifdef MOZ_MATHML
- Add system-headers wrappers for includes so that building with visibility on e.g. x86-64 works.
Attachment #243261 - Attachment is obsolete: true
Attachment #243837 - Flags: superreview?(roc)
Attachment #243837 - Flags: review?(roc)
Where are we going to land this? This code isn't going to be used in Gecko 1.9. Do you want to land this on the 1.8.1 branch?
(Reporter)

Comment 4

11 years ago
(In reply to comment #3)
> Where are we going to land this? This code isn't going to be used in Gecko 1.9.
> Do you want to land this on the 1.8.1 branch?

Any branch that affects future releases of Firefox 1.5.x (if any) and 2.x.
Those branches are only going to be taking security or serious stability fixes, I think, so this doesn't qualify.
(Reporter)

Comment 6

11 years ago
Created attachment 246341 [details] [diff] [review]
Updated patch

Attaching updated patch.  I merged back the PS nsFontMetricsPango into the Gtk+ one.  They are not the same file copied into gtk/ and ps/, with #ifdef sections when necessary.  Reduces maintenance.  Also in the patch is improved ligature and combining marks handling in justified text, and robust NUL/invalid text sequence handling.

Comment 7

11 years ago
(In reply to comment #5)
> Those branches are only going to be taking security or serious stability fixes,
> I think, so this doesn't qualify.
> 

I'm just curious, does "Those branches" include 2.x too?
Yes.

However, at the Firefox Summit we agreed to a change in policy that should allow this to land on branches. Stay tuned
Blocks: 346062

Updated

11 years ago
Status: UNCONFIRMED → NEW
Ever confirmed: true

Comment 9

11 years ago
roc, what do you think about this patch. Is it good enough for distributors to prefetch it?
I don't know. It's a pretty huge patch.
(Reporter)

Comment 11

11 years ago
So, no one has been touching the pango backend for a few years, and now I have a patch that fixes crashes, fixes printing, and fixes rendering of ligatures.  The patch is shipped in Fedora Core 6 and Red Hat Enterprise Linux 5.  I'm not sure that letting it sit here helps moving forward.  On the other hand, in a year or two it will be obsolete, so maybe I don't really care.

Cheers,

Updated

11 years ago
Component: General → GFX: Gtk
Product: Firefox → Core
QA Contact: general → gtk
Target Milestone: --- → mozilla1.8.1
Version: unspecified → 1.8 Branch
I haven't looked at the code, but knowing Behdad it's likely to be pretty good.  I would suggest that you guys look at the patch when he uploads it.
(Reporter)

Comment 13

11 years ago
The patch in comment #6 is the latest version for ff1.5.  Someone is porting it to ff2, I'll attach when it's done.
(Assignee)

Updated

9 years ago
Product: Core → Core Graveyard
I'm thinking there's no reason to leave this bug open anymore?
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → INCOMPLETE
(Reporter)

Comment 15

7 years ago
Heh, yeah.
You need to log in before you can comment on or make changes to this bug.