View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015301VTK(No Category)public2015-02-03 11:512015-04-02 08:42
ReporterLuc Habert 
Assigned ToDavid C. Lonie 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0015301: problem with vtkFreeTypeTools and Calibri
DescriptionOn a windows 7 system, I ran into a strange issue while trying to render the label for the y-axis of a vtkPlotPoints with Calibri, 18, bold. If the label text contains "AT", vtkFreeTypeTools::RenderCharacter will make an out of bounds acces in the image (vtkFreeTypeTools.cxx line 1477) when trying to render the T. Even stranger: displaying only T does not cause an issue.

The crashing rendering call is performed at vtkOpenGLContextDevice2D.cxx, line 834. The following code reproduces the crash:

    vtkNew<vtkTextRendererStringToImage> ren;
    vtkNew<vtkTextProperty> prop;
    prop->SetFontFile("c:\\Windows\\Fonts\\Calibri.ttf");
    prop->SetFontFamily(VTK_FONT_FILE);

    prop->SetFontSize(18);
    prop->SetBold(true);
    prop->SetOrientation(90);

    vtkNew<vtkImageData> image; // not initialized exactly as in vtkOpenGLContextDevice2D.cxx
    int textDims[2];

    ren->RenderString(prop.GetPointer(), vtkUnicodeString::from_utf8("AT"), image.GetPointer(), textDims);
TagsNo tags attached.
ProjectTBD
Typecrash
Attached Files

 Relationships

  Notes
(0034153)
Luc Habert (reporter)
2015-02-04 09:45

I have delved deeper with the debuger. The problem is that penX = -12 while the image's extent[0] = -11. This -12 comes from line 1469 that blindly adds the kerning returned by FT_Get_Kerning.

According to FT_Get_Kerning's documentation, this kerning is only valid for horizontal layouts, which I understand means the matrix is not taken into account. This interpretation is consistent with the result we have here: kerningDelta.x < 0 and kerningDelta.y = 0, although we have a vertical orientation.

A quick fix would be to ignore kerning in non-horizontal orientations. Perhaps applying the transform to the kerning would work fine, at least for orientation == 90, 180 or 270.
(0034156)
Dave DeMarle (administrator)
2015-02-05 11:43

Dave L, is Luc's proposed fix:
1) as easy to apply as is sounds
-- If so can you guide Luc on how to submit a patch?
2) likely to cause issues on the dashboard?
-- If so, lets delay any merge until after the imminent 6.2 release
(0034175)
David C. Lonie (developer)
2015-02-05 12:57

It's close, and a good catch.

The only bit that's not quite right is the interpretation of "horizontal layout". This doesn't refer to a transform, but rather how some languages (Chinese, for example) are sometimes laid out top-to-bottom, rather than left-to-right.

Indeed, the kerning function is ignoring the rotation matrix, as suggested by this mailing list discussion:

http://lists.gnu.org/archive/html/freetype/2001-10/msg00042.html [^]

I don't believe any of the default fonts embedded in VTK actually have kerning, hence why we haven't seen this before ;-)

I'm actually working (a lot) on the text renderers at the moment -- I'll sneak a fix for this in with some other changes soon. It shouldn't cause any issues, as the dashboards should stick with the same ol' unkerned fonts.
(0034216)
David C. Lonie (developer)
2015-02-12 16:04

Gerrit patch: http://review.source.kitware.com/#/c/19253/ [^]
(0034334)
David C. Lonie (developer)
2015-04-01 13:58

Gerrit is dead, long live gitlab:

https://gitlab.kitware.com/vtk/vtk/merge_requests/80 [^]

I split this off from the larger change so that we can get it merged faster...
(0034335)
David C. Lonie (developer)
2015-04-02 08:42

Merged into master: https://gitlab.kitware.com/vtk/vtk/commit/2177e64e63c769a4c7d0638723f09bf40a03bbfd [^]

 Issue History
Date Modified Username Field Change
2015-02-03 11:51 Luc Habert New Issue
2015-02-04 09:45 Luc Habert Note Added: 0034153
2015-02-05 11:40 Dave DeMarle Assigned To => David C. Lonie
2015-02-05 11:43 Dave DeMarle Note Added: 0034156
2015-02-05 12:57 David C. Lonie Note Added: 0034175
2015-02-12 16:04 David C. Lonie Note Added: 0034216
2015-02-12 16:04 David C. Lonie Status backlog => active development
2015-02-12 16:04 David C. Lonie Status active development => gerrit review
2015-04-01 13:58 David C. Lonie Note Added: 0034334
2015-04-02 08:41 David C. Lonie Status gerrit review => backlog
2015-04-02 08:42 David C. Lonie Note Added: 0034335
2015-04-02 08:42 David C. Lonie Status backlog => closed
2015-04-02 08:42 David C. Lonie Resolution open => fixed


Copyright © 2000 - 2018 MantisBT Team