GNOME Bugzilla – Bug 350726
WMF/EMF export does not use correct fonts
Last modified: 2008-05-03 14:46:14 UTC
Please describe the problem: When exporting to WMF or EMF under Windows, dia sometimes does not format the text according to diagram formatting, but leaves fonts to default. Steps to reproduce: 1. Create a new diagram and add some text. 2. Change the text formatting - e.g. change the font to Courier. Please note that this is NOT a TrueType font. 3. Export to EMF. 4. Open the EMF to see that the text is displayed with some kind of sans serif font, but not Courier. This also affects layout - the text in the exported file takes a different amount of space (usually more) than in the original diagram. Since by default dia uses the font "sans" for new text and it is not clear to the user which Windows font, if any, maps to "sans", this causes layout problems in the exported files. However, when using TrueType fonts for text, the export is performed correctly. Actual results: Expected results: The WMF/EMF file to have text formatted in the same way as in the original diagram. Does this happen every time? yes Other information: OS: Windows Server 2003 Appearance - "Windows Classic style" with no customizations.
Created attachment 79334 [details] [review] an idea to have more correct fonts It is not possible to select a non TrueType font from the menus under windows because Pango simply does filter them. But there are "magic" font names like "sans", "serif", "monospace", maybe even "courier" which wont lead to the same font being rendered on display as on WMF/EMF. Infact the font name from Pango is passed literally to the GDI. One way to solve this would be to map Pango's special names to the correct bits in CreateFont. The probably better one would be to render the text with Pango. A hacked version which does this is attached. I dont like it enough to be applied as is.
finally solved: 2008-05-03 Hans Breuer <hans@breuer.org> * plug-ins/wmf/wmf.cpp : use Pango for loading the font but not for rendering (taking the better part of my patch to fix bug #350726) * plug-ins/makefile.msc : link wmf with pangowin32.lib, clean-up