DWF

DWF

Reply
Active Member
timofey.tatarinov
Posts: 7
Registered: ‎02-16-2011
Message 1 of 5 (2,132 Views)
Accepted Solution

DWF Toolkit - font identification

2132 Views, 4 Replies
04-05-2011 06:22 AM

Hi,

 

I am converting w2d file to the custom graphical format. I converted geometry correctly but I had some problem with font conversion. Namely, "my" font size and font size at Design Review are different.

 

For idenetification font height I do next steps:

1) Get viewport and viewport units transform matrix (WT_Object::Viewport_ID)

currViewportUnitsMatrix = ((WT_Viewport*)pCurrObject)->viewport_units().dwf_to_application_adjoint_transform();

2) Process WT_Object::Text_ID:

a) Get WT_Font through rendition, which got early  WT_Rendition& rendition = _pFile->rendition();

WT_Font wtFont = rendition.font();

b) Convert logical font height value to the application value using viewport and units transform matrix

// for convert value we find distance between 0,0 point and value,0 point - ??? Is another way existing?

 

PointD point1 = ConvertLogicalPointToSourcePoint(WT_Logical_Point(0, 0), _viewportUnitsMatrix, _viewport);
 PointD point2 = ConvertLogicalPointToSourcePoint(WT_Logical_Point(_value, 0), _viewportUnitsMatrix, _viewport);
 double newValue = sqrt(pow(point1.m_x - point2.m_x, 2.0) + pow(point1.m_y - point2.m_y, 2.0));
PointD ConvertLogicalPointToSourcePoint(const WT_Logical_Point& _point, 
 const WT_Matrix& _viewportUnitsMatrix,
 const Viewport& _viewport)
{
  WT_Point3D point(_point.m_x, _point.m_y);
  WT_Point3D tansformPoint;
  _viewportUnitsMatrix.transform(point, tansformPoint);
  return PointD(tansformPoint.m_x + _viewport.deltaX, 
  tansformPoint.m_y + _viewport.deltaY);
}

 

...

 

After these operations I get a font height which I use in project and it is different from right Design Review height.

What I do wrong?

 

Another question about font name and family. What I should use for identifying font name WT_Font::font_name() or WT_Font::family()?

 

 

Thanks

Do you want to convert the text font height to the real text height?  If yes then in step 2) ->b):

  1. Convert the WT_Font to HFONT;
  2. Draw the text with HFONT in a device context;
  3. Get the text height;
  4. Multiply the text height and the viewport scale; then we can get the real text height.

Please let me know if you have any further questions.

Employee
SilviaCao
Posts: 136
Registered: ‎06-07-2009
Message 2 of 5 (2,111 Views)

Re: DWF Toolkit - font identification

04-11-2011 02:24 AM in reply to: timofey.tatarinov

Do you want to convert the text font height to the real text height?  If yes then in step 2) ->b):

  1. Convert the WT_Font to HFONT;
  2. Draw the text with HFONT in a device context;
  3. Get the text height;
  4. Multiply the text height and the viewport scale; then we can get the real text height.

Please let me know if you have any further questions.



Silvia Cao
SW Engineer
PSEB-GE- ACRD PSEB
Autodesk, Inc.
Active Member
timofey.tatarinov
Posts: 7
Registered: ‎02-16-2011
Message 3 of 5 (2,107 Views)

Re: DWF Toolkit - font identification

04-11-2011 06:27 AM in reply to: timofey.tatarinov

Your solution is working! I converted the text font height to the real text height.

 

Thank you for quick reply.

 

---

Timofey Tatarinov

Active Member
timofey.tatarinov
Posts: 7
Registered: ‎02-16-2011
Message 4 of 5 (2,105 Views)

Re: DWF Toolkit - font identification

04-11-2011 06:50 AM in reply to: SilviaCao

Silvia Cao,

 

Our application is working on Windows now. But we want to support our system on linux too. And we have a question:

What can we do for converting of the text font height to the real text height on linux?

 

Thanks

Employee
SilviaCao
Posts: 136
Registered: ‎06-07-2009
Message 5 of 5 (2,098 Views)

Re: DWF Toolkit - font identification

04-11-2011 07:18 PM in reply to: timofey.tatarinov

The font supported in DWF is TrueType; so we need to install the graphics library which can support the TrueType (like Simple DirectMedia Layer); and then process the text like in Windows.

 

Please let me know if you have any further questions.



Silvia Cao
SW Engineer
PSEB-GE- ACRD PSEB
Autodesk, Inc.
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.