[MPEG-OTSPEC] exponentiation (was RE: "font directory" / "offset table" / "table directory"

Peter Constable pgcon6 at msn.com
Mon Aug 31 02:52:59 CEST 2020


This describes symbols used in various languages:

https://en.wikipedia.org/wiki/Exponentiation#In_programming_languages

There isn't a perfect answer. I think the best answer is whatever would be most intuitive / less likely to be mis-interpreted.

-----Original Message-----
From: Peter Constable <pgcon6 at msn.com> 
Sent: Sunday, August 30, 2020 5:43 PM
To: Peter Constable <pgcon6 at msn.com>; Laurence Penney <lorp at lorp.org>; MPEG OT Spec list (mpeg-otspec at lists.aau.at) <mpeg-otspec at lists.aau.at>
Subject: exponentiation (was RE: [MPEG-OTSPEC] "font directory" / "offset table" / "table directory"

Separate topic:

In the description of cmap format 4, "**" is used as an exponentiation operator in the description of the searchRange field, but it appears some younger readers don't recognize that notation from older programming languages. So, I different notation should be used, preferably one that would be readily understood by readers who might or might not be familiar different language. (This will apply also to description of a similar field in the table directory (aka offset table).)

One possibility is to use pow(). E.g., 

2 * pow(2, floor(log2(segCount)))


Another is to use "^". E.g., 

2 * (2 ^ floor(log2(segCount)))

(I'd keep the extra parens to avoid any uncertainty regarding operator precedence.)


There may be other possibilities.

Recommendations?


Peter

-----Original Message-----
From: mpeg-otspec <mpeg-otspec-bounces at lists.aau.at> On Behalf Of Peter Constable
Sent: Sunday, August 30, 2020 5:32 PM
To: Laurence Penney <lorp at lorp.org>; MPEG OT Spec list (mpeg-otspec at lists.aau.at) <mpeg-otspec at lists.aau.at>
Subject: Re: [MPEG-OTSPEC] "font directory" / "offset table" / "table directory"

I had considered "^", but that is bitwise XOR in C, Python and other languages du jour. I'm open to input, though.

(This is yet another topic.)

-----Original Message-----
From: mpeg-otspec <mpeg-otspec-bounces at lists.aau.at> On Behalf Of Laurence Penney
Sent: Sunday, August 30, 2020 1:39 PM
To: MPEG OT Spec list (mpeg-otspec at lists.aau.at) <mpeg-otspec at lists.aau.at>
Subject: Re: [MPEG-OTSPEC] "font directory" / "offset table" / "table directory"

> On 30 Aug 2020, at 20:43, Peter Constable <pgcon6 at msn.com> wrote:
> 
> Separating the fingerprint from the rest of the structure would end up being messy in describing the organization of TTCs … it feels cleaner to say the offsets are to the table directory of each font resource, and that the font resource beings with sfntVersion.

Yes, that makes sense.

>> To avoid confusion it may be helpful to provide pseudocode for calculating them.
> 
> There are similar fields in cmap format 4, and they are described with formulae. E.g., "2 × (2**floor(log2(segCount)))". Now, one of the issues opened on that chapter is that someone wasn't familiar with the Fortran "**" operator and so misunderstood the intent. It seems like something less language specific is needed. Taking that in mind, something similar could be done here. E.g., "pow(floor(log2(numTables)), 2) × 16". Or include both prose description and formula.

Good point, "**" is not clear to whippersnappers.

BTW the two definitions can be made identical apart from the factors 16 (for table directory) and 2 (for cmap). Please also consider an asterisk (*) over the typographic multiply sign, unless the whole thing uses math typography, and also consider the ascii circumflex (^) over pow().

- Laurence

_______________________________________________
mpeg-otspec mailing list
mpeg-otspec at lists.aau.at
https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.aau.at%2Fmailman%2Flistinfo%2Fmpeg-otspec&data=02%7C01%7C%7Cab8f76cb75d54fc434d908d84d46be45%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637344313512313008&sdata=zOeGdidOuD3jmfkz5ABGblbmlkiNH%2FShfsj8kUPXJos%3D&reserved=0
_______________________________________________
mpeg-otspec mailing list
mpeg-otspec at lists.aau.at
https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.aau.at%2Fmailman%2Flistinfo%2Fmpeg-otspec&data=02%7C01%7C%7Cab8f76cb75d54fc434d908d84d46be45%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637344313512323001&sdata=9ujsTE%2BuUWHq1wwNHc1OZSipr9CUCVV9WN%2FE3gRFwEc%3D&reserved=0


More information about the mpeg-otspec mailing list