Forum > LazUtils

LazFreeType font types

<< < (2/3) > >>

Graeme:

--- Quote from: MNeto on June 27, 2016, 07:05:12 pm ---I did not know I should use the PostScript font name. I was using the names with which the font is recognized by the system.

--- End quote ---
The reason we used the PostScript name in the FontCache lookup, is because the Family Name doesn't supply enough information to extract the exact TTF or OTF file you want. Note that you have one font file for each font attribute (Regular, Bold, Italic, Bold+Italic etc). So if we only used the Family Name, the FontCache would have had to return a list of TTF or OTF files. Not what we normally wanted.  That is also why the Find() method has the parameter name APostScriptName, to try and make it clearer to the developer.

For convenience, we also supplied some overloaded Find() methods. One of them takes the Family Name as an argument, but it requires two other parameters as well.

Anyway, glad it is working for you now. :)

MNeto:
Thank you!

One more question. I am having difficulty understanding the value returned by ItalicAngle property.


--- 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";}};} ---CacheItem: = CacheList.Find ('STIX-Italic');     WriteLn (IntToStr (CacheItem.FontData.ItalicAngle)); // Returns 4293897093
What is the interpretation of this number?
The ItalicAngle variable is of the type longword, which is an unsigned Integer. But FontForge warns that the italic angle to this font is -16.33.

The amount received by the variable is raw bytes? Some conversion is needed?

Graeme:

--- Quote from: MNeto on July 02, 2016, 06:57:52 pm ---One more question. I am having difficulty understanding the value returned by ItalicAngle property.

--- End quote ---

I got the info from here:
   https://www.microsoft.com/typography/otspec/post.htm

Look at than and the fpparsettf.pp unit, there is indeed a bug with ItalicAngle. We used a LongWord data type instead of a LongInt data type. I'll give this ASAP and get FPC Trunk update as soon as possible.


--- Quote ---But FontForge warns that the italic angle to this font is -16.33.

--- End quote ---
I'm not 100% sure why FontForge is complaining. Maybe because it is using a floating point? Instead of -16. I've reviewed about 10 italic fonts and all use a LongInt range, not floating points. But then that's just 10 fonts I sampled out of hundreds of thousands of fonts out there. I'll look into ItalicAngle a bit more.

MNeto:
Thanks.

I already knew the site you indicated to me. On this page is informed that the italic angle is of type 'Fixed'.

In https://www.microsoft.com/typography/otspec/otff.htm page, is shown that the data type 'Single', in the "data type table" is:


--- Quote ---Fixed --> 32-bit signed fixed-point number (16.16)
--- End quote ---

This may explain why the FontForge show that value ...

It would be interesting to replace the longword type for a single type (or Double)?
Why an integer type was used?

By the way, I'm not accustomed to thinking in fixed point ... just floating point.

What will be the type of Free Pascal data that most fits the definition of Fixed shown on the Microsoft website?

Graeme:

--- Quote from: MNeto on July 04, 2016, 03:46:52 am ---It would be interesting to replace the longword type for a single type (or Double)?
Why an integer type was used?

--- End quote ---
This has been fixed in FPC Trunk as commit r34060.

"Fixed Point" mathematics is sometime faster or more convenient than floating point mathematics. Also in was often used in the olden days (eg: The DOOM game from ID Software) where not all target CPU types  had FPU functionality (eg: Intel 386).

Wikipedia has a good explanation of Fixed Point mathematics.


--- Quote ---What will be the type of Free Pascal data that most fits the definition of Fixed shown on the Microsoft website?

--- End quote ---
One also needs to take into account if the fixed point data type is signed or unsigned. The 'Fixed' data type used by TTF's ItalicAngle is a Signed Fixed Point 16.16, thus in Object Pascal you have to use a Int32 data type, and that is what I've done.

So the TPostScript.ItalicAngle uses a custom TF16Dot16 data type, which in turn is a Int32 (signed). So the TPostScript.ItalicAngle will return the exact fixed point value from the TTF file.

For convenience, I've also modified the TTFFileInfo.ItalicAngle() function which returns the ItalicAngle value as a Single data type. So this is probably what you would want to use.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version