Forum > LazUtils

[Solved]LazFreeType parasitic contours

(1/2) > >>

zamtmn:
I noticed that for some fonts LazFreeType produces spurious contours.
For example calibri.ttf from windows\fonts - see attached screenshot.
This prevents to obtain a correctly char image in my application. I attached a small test application to see this bug

marcov:

One of the for loops is wrong:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---for j:=0 to _glyph^.outline.n_points do
iterates over outline.n_points+1 points.

zamtmn:
Thank you. but it is not everything. I fix it and athach new bugscreen.

As I understand the problem lies somewhere near this place
components\lazutils\ttgload.pas line 1220

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---   (* copy also the phantom points, the debugger needs them *)   inc( num_points, 2 );and shows if in symbols inscription uses "subglyph`s"

marcov:
Seems ttf has two extra phantom points to pass values:

(from a MS document found via google:)

--- Quote ---The font scaler will always add two “phantom points” to the end of every outline. If the entire set of contours for a glyph requires “n” points (i.e., contour points numbered from 0 to n-1), then the scaler will add points n and n+1. These points will be placed on the character baseline. Point “n” will appear at the character origin, while “n+1” will be placed at the advance width point.
Both points (n and n+1) may be controlled by TrueType instructions, with corresponding effects on the sidebearings and advance width of the instructed glyph. The side bearings and advance width that are computed using these phantom points are called the device-specific widths (since they reflect the results of grid fitting the width along with the glyph to the characteristics of the device). The device-specific widths can be different from or identical to the linearly scaled widths (obtained by simple scaling operations), depending on the instructions applied to the phantom points.
--- End quote ---

Or: you shouldn't draw them.

zamtmn:
But how do I distinguish between such points. and why in other fonts they do not exist?

Navigation

[0] Message Index

[#] Next page

Go to full version