Community
DWF
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DWF Toolkit - font identification

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
timofey.tatarinov
2732 Views, 4 Replies

DWF Toolkit - font identification

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

4 REPLIES 4
Message 2 of 5

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.
Message 3 of 5

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

 

Thank you for quick reply.

 

---

Timofey Tatarinov

Message 4 of 5

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

Message 5 of 5

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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

”Boost

 

”Tips

 

”Services