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 <[email protected]>
To: [email protected]
Subject: Type error in ttfautohint
Message-ID:
    <cacjfywrghvpetb35rqlt_xnfprxpybxwas0b2-out0fhwi4...@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