freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Type error in ttfautohint Re: Freetype-devel Digest, Vol 216, Issue


From: Mike Sapsard
Subject: Re: Type error in ttfautohint Re: Freetype-devel Digest, Vol 216, Issue 3)
Date: Thu, 26 Jan 2023 19:06:08 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

Thanks Hin-Tak,

I did try typecasting the result, and that was worse. Strangely, Pilcrow ran correctly with my change.

I will let them know as well.

Mike

On 26/01/2023 17:56, Hin-Tak Leung wrote:
Your fix is wrong. And you are also reporting to the wrong people too - pillcrow is probably who you should write to. That said, it is a very common misunderstanding: numbers in freetype are not conventional floats in other programs. They are "encoded integers", called F26.6 in this case I think (read the documentation), where a 32-bit integer is to be interpreted as 26bit for the integer part and 6 bits for the fractional part (ie 128 is really 2, and 100 is 1 + 36/64).

Thus your "fix" should probably be 
int(width * 2 / 3 * 64), etc. For example. Note the *64. Read the documentation on F26.6, F10.6, etc.

Today's Topics:

  1. Type error in ttfautohint (Mike Sapsard)


----------------------------------------------------------------------

Message: 1
Date: Thu, 26 Jan 2023 13:53:59 +0000
From: Mike Sapsard <mike.sapsard@gmail.com>
Subject: Type error in ttfautohint
Message-ID:
    <CACJfywrGHVPeTb35rQLT_XnfPrXpybxwAS0B2-Out0fHWi4kAw@mail.gmail.com" rel="nofollow" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">CACJfywrGHVPeTb35rQLT_XnfPrXpybxwAS0B2-Out0fHWi4kAw@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Using Pilcrow in Linux Mint 21.1 with Python 3.10.6
ttfautohint home page: <https://www.freetype.org/ttfautohint>
File "/home/mike/pilcrow-main/DefineSources.py", line 121, in
initializePage
    self.splitter.setSizes([width * 2/3, width * 1/3])
TypeError: index 0 has type 'float' but 'int' is expected

Fixed by adding int() typecasts as below:
self.splitter.setSizes([int(width * 2/3), int(width * 1/3)])

Regards Mike Sapsard


reply via email to

[Prev in Thread] Current Thread [Next in Thread]