[mapserver-users] problem using some fonts on pdf output

José María Michia jose.maria.michia at gmail.com
Mon Dec 15 13:38:48 EST 2008


2008/12/15 Brent Fraser <bfraser at geoanalytic.com>:
> José,
>
>  I did some investigation and I think I found the line in mappdf.c that
> needs to be changed, line 1318:
>
>   /*load font using alias*/
> //  font = PDF_load_font(pdf, "f1" ,0 ,"winansi", NULL
>   font = PDF_load_font(pdf, label->font ,0 ,"winansi", "embedding=true" );//
> changed so (multiple) fonts are embedded
>
>
> It appears to work on my XP computer, but I don't have a linux box to test
> on.  So if someone could test on linux etc, I'd appreciate it.

I tried this on my Linux, and works well.

Note: if the font who used, have license restrictions, the font can
not be embedded.

> And I see there's support for an alternate PDF library planned:
> http://trac.osgeo.org/mapserver/ticket/2661
>
> Brent Fraser

Thanks very much Brent. Now, I will to use "Times" where I desired.

Something strange (to me) with this: I have not had a problem to use
"Italic Times" in the first case where I could not use Times.

In the file "FONTSET," I have defined:

times   /fontpath/times.ttf
timesi   /fontpath/timesi.ttf

Before modify the code with the changes proposed by Brent, "times" was
substituted for "Sans", but "timesi" remained "Times Italic" (in the
PDF file).

Saludos
José María

> José María Michia wrote:
>>
>> 2008/12/12 Brent Fraser <bfraser at geoanalytic.com>:
>>>
>>> José,
>>>
>>>  I think it has to do with font embedding in the output pdf.  Looking at
>>> the
>>> source code, Mapserver appears to embed fonts used for symbols, but not
>>> for
>>> text labels.
>>>
>>> Brent Fraser
>>
>> I've tried use the font Times as symbol, and yes, font are embedded in
>> the resultant pdf. But, the labels using the same font in this file,
>> not uses the same font. This is only a test, is not a good solution,
>> because forcing to use the desired font as symbol.
>>
>> Maybe is easy to change the code for include in the PDF the fonts used
>> in labels, but not for me  right now. I hope to learn how some day.
>>
>> Thanks to Brent and all the people of MapServer.
>> Saludos
>> José María
>>
>>> José María Michia wrote:
>>>>
>>>> Hi all.
>>>>
>>>> I have a mapfile, with some layers, with labels. I wish to use two
>>>> differents fonts, "arial" and "times". I have the two fonts as tff.
>>>> All work fine when I use shp2img utility program for make PNG files.
>>>> But, when I change output format to PDF, the text that must be in
>>>> times font, appears in other font (a Sans variant). I've opened the
>>>> PDF in Acroread and Inkscape, with same results.
>>>>
>>>> I'm using:
>>>>
>>>> Linux Gentoo
>>>> Mapserver 5.2.1 from sources
>>>>
>>>> "Sans" is nice font, and I happy with the map produced, but I wish to
>>>> know what happens. (I need "PDF files", and not "PNG files", because
>>>> the final maps are hardcopy maps).
>>>>
>>>> Thanks for any advice.
>>>>
>>>> Saludos
>>>> José María
>>>> _______________________________________________
>>>> mapserver-users mailing list
>>>> mapserver-users at lists.osgeo.org
>>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>>>
>>
>


More information about the mapserver-users mailing list