[gdal-dev] Encoding when creating pdf

Aneta Muslić a.muslic at outlook.com
Wed Nov 4 01:56:48 PST 2020


Hello,

I am using gdal version 2.4.4 in my c# app.
As a part of my project I am creating pdf with gdal_translate command. GDAL translate command is
"gdal_translate  --config SHAPE_ENCODING "utf-8" -of PDF -tr 0.001 0.001 -a_srs EPSG:3765 Granice.tif Sisacko_moslavacka_zupanija3.pdf -co OGR_DATASOURCE=Extent.vrt".

Part of vrt file that displays labels is:
<OGRVRTLayer name="SHPCounties">
<SrcDataSource relativeToVRT="0">MSSQL: driver={SQL Server Native Client 11.0};
server=xxx;uid=xx;pwd=xx;database=HAPIH;
Integrated Security=False;MARS_Connection=yes</SrcDataSource>
<SrcLayer>SHPCounties</SrcLayer>
<LayerSRS>EPSG:3765</LayerSRS>
<SrcSQL>
select Geometry.STCentroid() as pointPolygonCounties,
CAST(Name AS varchar(100)) COLLATE Croatian_CI_AI AS NameCollated,
'LABEL(f:"Times New Roman",t:{NameCollated},c:#000000,s:40pt)' AS OGR_STYLE
FROM SHPCounties
</SrcSQL>
<GeometryType>wkbPoints</GeometryType>
<GeometryField name="pointPolygonCounties" />
</OGRVRTLayer>

My labels have special characters (č and ć). I defined encoding to utf-8 and gdal-config as utf-8 but in generated pdf under fonts I can see that the font used is Times New Roman with encoding ansi, and characters č and ć are replaced with c because ansi doesn't support those letters. I tried writing just the letter 'č' to pdf so I can eliminate that the problem is in database but it is replaced with something else in pdf,  also I tried using html entity for those letters but it doesn't help.

I would like to know how can I define in label options of vrt file for it to use font with custom encoding and not ansi encoding so it can display my special characters or there is another way for me to display those special characters.

Thank you.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20201104/ad26f180/attachment.html>


More information about the gdal-dev mailing list