From: Dom Lachowicz (domlachowicz@yahoo.com)
Date: Fri Jan 24 2003 - 17:17:04 EST
Hi Robert,
On Unix, AbiWord has 2 printing drivers.
1) Our own PS generator
2) A driver based on GnomePrint
I'm working on making #2 functional again. If
wxWindows can have a Gnome dependency, I *highly*
recommend using libgnomeprint and libgnomeprintui
versions 2.2.x
So, our printing is done in a fashion very similar to
on-screen drawing, or how your "device contexts" work.
We have a series of vector drawing operations:
moveTo()
lineTo()
fillRect()
setColor()
setFont()
...
Pretty much all of these have a 1:1 mapping onto PS
and PDF drawing operations.
Now, one can't use Pango to print, at least not yet.
Any pango related code in that file is dead and should
probably be pruned out.
The hardest part of printing is actually acquiring the
font metrics and font data itself (i.e. the font file
on disk) so that we can embed the font directly in the
PS output, instead of merely referencing it by name.
See any PS or PDF manual for what that means.
Now, we use Xft2/FontConfig if possible to get the
font metrics and font files themselves. PFA/PFB fonts
and TTF fonts are by definition printable. Using
FontConfig, we are able to get a handle to the font
file. If you don't do this, uhm... yeah, you're going
to have issues (GnomePrint will do this for you
automagically, btw). Now that we have the font data
itself, we can slam it into the PS output file, and
then spool that to LPR, ghostscript, etc...
Anyway, to get a working PS driver written, you don't
need Pango, Freetype, FriBidi, or any of that, really,
for the 99% case. If you can assume that either
GnomePrint 2.2 or Xft2/Fontconfig is installed and
have a way to convert text to UTF8 or UCS4, it's
pretty trivial to craft a fairly functional PS driver
device context.
Dom
--- Robert Roebling <Robert.Roebling@t-online.de>
wrote:
>
> Hello,
>
> although it doesn't really matter as ar as
> my question is concerned, but I am one of
> the main authors of the wxWindows library,
> which the very early AbiWord team considered
> to use instead of writing all the platform
> dependent GUI code for each platform. Since
> both projects rather often have to address
> similar problems, it might have been easier
> for both to cooperate, but that didn't happen
> for whatever reason.
> Never mind, as the main and almost only
> GTK and GTK2 developer of wxWindows, I am
> currently investigating new ways to support
> printing under wxWindows. AbiWord's and
> wxWindows's graphics and printing system
> are almost identical in design, with what
> is called a "device context" in wxWindows
> and "GR_something" in AbiWord which I got
> from CVS HEAD a few days back. I am posting
> here, because I could not find something
> like a design document for the printing
> system and the code is totally cluttered
> with #ifdefs for Pango and Xft. Am I right
> that under AbiWord's new GTK2 version, text
> is rendered on screen using GTK2's Pango,
> but that AbiWord uses Xft to find and work
> with fonts for PostScript output?
> What version requirements do you have for
> both libararies? I have a stock SuSE 8.1
> which is the newest you can get, but maybe
> I'll need the BRAND newest code for either
> of FreeType, XRender, Xft, Pango, FriBidi
> or even something else before I can start
> to compile the system.
>
> Thanks for any info,
>
> Robert
>
>
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
This archive was generated by hypermail 2.1.4 : Fri Jan 24 2003 - 17:20:47 EST