Skip to content

Commit

Permalink
DXF: add font of TEXT and MTEXT to OGR style string (patch by Nikolai…
Browse files Browse the repository at this point in the history
… Lebedev, OSGeo/gdal#198)

git-svn-id: https://svn.osgeo.org/gdal/trunk/gdal@37571 f0d54148-0727-0410-94bb-9a71ac55c965
  • Loading branch information
rouault committed Mar 3, 2017
1 parent e1c02c4 commit 598c00e
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions ogr/ogrsf_frmts/dxf/ogrdxflayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ OGRFeature *OGRDXFLayer::TranslateMTEXT()
bool bHaveZ = false;
int nAttachmentPoint = -1;
CPLString osText;
CPLString osStyleName = "Arial";

while( (nCode = poDS->ReadValue(szLineBuf,sizeof(szLineBuf))) > 0 )
{
Expand Down Expand Up @@ -524,6 +525,10 @@ OGRFeature *OGRDXFLayer::TranslateMTEXT()
dfAngle = CPLAtof(szLineBuf);
break;

case 7:
osStyleName = TextUnescape(szLineBuf);
break;

default:
TranslateGenericProperty( poFeature, nCode, szLineBuf );
break;
Expand Down Expand Up @@ -596,7 +601,7 @@ OGRFeature *OGRDXFLayer::TranslateMTEXT()
CPLString osStyle;
char szBuffer[64];

osStyle.Printf("LABEL(f:\"Arial\",t:\"%s\"",osText.c_str());
osStyle.Printf("LABEL(f:\"%s\",t:\"%s\"", osStyleName.c_str(), osText.c_str());

if( dfAngle != 0.0 )
{
Expand Down Expand Up @@ -652,6 +657,7 @@ OGRFeature *OGRDXFLayer::TranslateTEXT()
double dfAngle = 0.0;
double dfHeight = 0.0;
CPLString osText;
CPLString osStyleName = "Arial";
bool bHaveZ = false;
int nAnchorPosition = 1;
int nHorizontalAlignment = 0;
Expand Down Expand Up @@ -695,6 +701,10 @@ OGRFeature *OGRDXFLayer::TranslateTEXT()
nVerticalAlignment = atoi(szLineBuf);
break;

case 7:
osStyleName = TextUnescape(szLineBuf);
break;

default:
TranslateGenericProperty( poFeature, nCode, szLineBuf );
break;
Expand Down Expand Up @@ -804,8 +814,8 @@ OGRFeature *OGRDXFLayer::TranslateTEXT()
CPLString osStyle;
char szBuffer[64];

osStyle.Printf("LABEL(f:\"Arial\",t:\"%s\"",osText.c_str());

osStyle.Printf("LABEL(f:\"%s\",t:\"%s\"", osStyleName.c_str(), osText.c_str());
osStyle += CPLString().Printf(",p:%d", nAnchorPosition);

if( dfAngle != 0.0 )
Expand Down

0 comments on commit 598c00e

Please sign in to comment.