Bug 328166 - Composite Characters are displayed incorrectly
Summary: Composite Characters are displayed incorrectly
Status: RESOLVED FIXED
Alias: None
Product: GMF-Runtime
Classification: Modeling
Component: General (show other bugs)
Version: 2.3.1   Edit
Hardware: PC Windows XP
: P3 normal
Target Milestone: 1.4.2   Edit
Assignee: Alex Boyko CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-19 13:56 EDT by Alex Boyko CLA
Modified: 2010-10-21 12:04 EDT (History)
2 users (show)

See Also:


Attachments
diagram that demonstrates the issue (1.34 KB, application/octet-stream)
2010-10-19 13:56 EDT, Alex Boyko CLA
no flags Details
possible fix (9.33 KB, patch)
2010-10-19 14:06 EDT, Alex Boyko CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Boyko CLA 2010-10-19 13:56:37 EDT
Created attachment 181210 [details]
diagram that demonstrates the issue

If a label has a non-latin string it's displayed fine on the diagram. However if it's exported to PNG or JPEG image via Batik, i.e. via AWT Graphics 2D and hence GMF's GraphicsToGraphics2DAdaptor the string can be displayed differently... characters may have a different size and the string may be cut-off.
Attached is the geo-shape diagram that demonstrates the issue on Win XP with no japanese fonts installed and on Win 7.
Comment 1 Alex Boyko CLA 2010-10-19 14:06:05 EDT
Created attachment 181211 [details]
possible fix

I figured that it's probably best to create an SWT bitmap of such string, convert the bitmap to AWT bitmap and then paint on AWT graphics.
The criteria determining whether a bitmap needs to be created or just paint the string is the comparison of AWT and SWT string widths. If the difference in width is more than 2 pixels then an SWT bitmap is created. Therefore, if japanese fonts are installed the string will just be painted with AWT graphics, otherwise the widths difference is over 2 pixels and a bitmap is created.
GraphicsSVG is a vector format consequently there is no need to create an SWT bitmap at all. Therefore the string is just added to the SVG DOM (regular painting) and it's up to the SVG rendering app to paint this correctly, i.e. Firefox.

Lidija, can you please review this patch and tell what you think?
Comment 2 Lidija Grahek CLA 2010-10-20 15:18:21 EDT
I am OK with the patch. As a workaround to the AWT issue, it is going to take a bit longer (for generating SWT bitmap) but it's either that or it doesn't work.
Comment 3 Alex Boyko CLA 2010-10-21 12:04:54 EDT
Delivered to R1_4_maintenance for GMF 2.3.2 and HEAD. Will see how this fix will work out for us.