Opened 14 years ago

Closed 12 years ago

Last modified 12 years ago

#3392 closed defect (fixed)

DGN Driver does not preserve font name in text features

Reported by: manelclos Owned by: chaitanya
Priority: normal Milestone:
Component: OGR_SF Version: unspecified
Severity: normal Keywords: dgn
Cc: warmerdam

Description (last modified by warmerdam)

While reading a DGN, the font name is missing in the style, which results in information loss.

Font name "INTL_WORKING" is not shown and discarded when writing the feature to another DGN file.

Running version 1.5.2, so perhaps this is solved in SVN -> font_id? http://trac.osgeo.org/gdal/browser/trunk/gdal/ogr/ogrsf_frmts/dgn/dgnread.cpp

$ ogrinfo font_name.dgn  elements
INFO: Open of `font_name.dgn'
      using driver `DGN' successful.

Layer name: elements
Geometry: Unknown (any)
Feature Count: 1
Extent: (485373.153000, 4647774.904000) - (485417.999000, 4647782.905000)
Layer SRS WKT:
(unknown)
Type: Integer (2.0)
Level: Integer (2.0)
GraphicGroup: Integer (4.0)
ColorIndex: Integer (3.0)
Weight: Integer (2.0)
Style: Integer (1.0)
EntityNum: Integer (0.0)
MSLink: Integer (0.0)
Text: String (0.0)
OGRFeature(elements):17
  Type (Integer) = 17
  Level (Integer) = 62
  GraphicGroup (Integer) = 0
  ColorIndex (Integer) = 21
  Weight (Integer) = 1
  Style (Integer) = 0
  EntityNum (Integer) = (null)
  MSLink (Integer) = (null)
  Text (String) = Font Name Test
  Style = LABEL(t:"Font Name Test",c:#f000f0,s:4.000g)
  POINT (485373.152999999991152 4647776.904000000096858)

Attachments (1)

font_name.dgn (13.5 KB ) - added by manelclos 14 years ago.
DGN v7 with a text feature

Download all attachments as: .zip

Change History (11)

by manelclos, 14 years ago

Attachment: font_name.dgn added

DGN v7 with a text feature

comment:1 by warmerdam, 14 years ago

Cc: warmerdam added
Component: defaultOGR_SF
Description: modified (diff)
Keywords: dgn added
Owner: changed from warmerdam to chaitanya

Chaitanya,

Could you look into this?

comment:2 by chaitanya, 14 years ago

Status: newassigned

Frank,

The font in DGN format is stored as a single byte pointing to the font name in a Microstation resource file, which I couldn't get a hold of. As of now, the only font id I could find is for 'INTL_WORKING', 33.

For now I want to represent the fonts as MstnFont<byte value>. This doesn't help in translations from or to other formats but will work well for editing DGN files.

comment:3 by warmerdam, 14 years ago

Agreed, please go ahead.

You might also consider emailing the dgnlib mailing list and ask if anyone is aware of a way to turns these codes into more normal font names.

comment:4 by chaitanya, 12 years ago

Resolution: fixed
Status: assignedclosed

Added the support for font and a test to read and write the font name in the trunk(r24137).

comment:5 by Even Rouault, 12 years ago

Resolution: fixed
Status: closedreopened

r24137 makes compiler to warn loudly. Seems to be const related

ogrdgnlayer.cpp: In member function ‘DGNElemCore** OGRDGNLayer::TranslateLabel(OGRFeature*)’:
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’
ogrdgnlayer.cpp:948: warning: deprecated conversion from string constant to ‘char*’

in reply to:  5 comment:6 by chaitanya, 12 years ago

Replying to rouault: Even, I couldn't find an easy workaround to avoid this warning. Can you suggest something?

comment:7 by Even Rouault, 12 years ago

I haven't looked in detail. But it must be a matter of changing char* to const char*, or something like that.

For reference, my env is Ubuntu 10.04 with gcc (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3

in reply to:  7 comment:8 by chaitanya, 12 years ago

Resolution: fixed
Status: reopenedclosed

Replying to rouault: I have the same env.

I made the change in the trunk(r24141) to avoid the deprecation warnings.

comment:9 by mchapman, 12 years ago

I have taken the liberty to revert the last change and just do a single cast to (char ). The cast is (unfortunately) necessary since most of the CSL functions were not create with an appropriate constness.

But I found dynamically creating the list quite unfortunate.

Thanks for addressing the core problem!

comment:10 by warmerdam, 12 years ago

Note, the last was really "warmerdam", not mchapman.

Note: See TracTickets for help on using tickets.