MantisBT - VTK |
| View Issue Details |
|
| ID | Project | Category | View Status | Date Submitted | Last Update |
| 0015301 | VTK | (No Category) | public | 2015-02-03 11:51 | 2015-04-02 08:42 |
|
| Reporter | Luc Habert | |
| Assigned To | David C. Lonie | |
| Priority | normal | Severity | minor | Reproducibility | have not tried |
| Status | closed | Resolution | fixed | |
| Platform | | OS | | OS Version | |
| Product Version | | |
| Target Version | | Fixed in Version | | |
| Project | TBD |
| Type | crash |
|
| Summary | 0015301: problem with vtkFreeTypeTools and Calibri |
| Description | On 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);
|
| Steps To Reproduce | |
| Additional Information | |
| Tags | No tags attached. |
| Relationships | |
| Attached Files | |
|
| 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 |
|
Notes |
|
|
(0034153)
|
|
Luc Habert
|
|
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
|
|
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
|
|
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
|
|
2015-02-12 16:04
|
|
|
|
|
(0034334)
|
|
David C. Lonie
|
|
2015-04-01 13:58
|
|
|
|
|
(0034335)
|
|
David C. Lonie
|
|
2015-04-02 08:42
|
|
|