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

Peter Constable pgcon6 at msn.com
Mon Aug 31 19:18:45 CEST 2020


"^" would certainly suggest the intended meaning for people from a number of backgrounds. But for many from backgrounds, it could suggest a _wrong_ meaning of XOR, which is worse than something that's just not familiar. The Wikipedia article (https://en.wikipedia.org/wiki/Exponentiation#In_programming_languages) mentions several contexts in which "^" means XOR, but doesn't indicate any contexts in which "**" has a meaning that's not exponentiation.


Peter

-----Original Message-----
From: David Singer <singer at apple.com> 
Sent: Monday, August 31, 2020 10:11 AM
To: Norbert Lindenberg <mpeg-otspec at lindenbergsoftware.com>
Cc: Peter Constable <pgcon6 at msn.com>; MPEG OT Spec list (mpeg-otspec at lists.aau.at) <mpeg-otspec at lists.aau.at>
Subject: Re: [MPEG-OTSPEC] exponentiation (was RE: "font directory" / "offset table" / "table directory"

It might be nice to write the equation in such a way that they can be converted to nice MathML, and AsciiMath uses ^

see

https://eur06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fasciimath.org%2F&data=02%7C01%7C%7Ca6670ba185804b73270708d84dd0e083%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637344906793030152&sdata=hlJz2%2BVxInyvRgQR5TiZaMKDSLhmQjTGBauNXJNAZ2k%3D&reserved=0

where I get nice MathML if I enter

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

but not

2 × (2**floor(log2(segCount)))

> On Aug 30, 2020, at 22:41 , Norbert Lindenberg <mpeg-otspec at lindenbergsoftware.com> wrote:
> 
> You could simply add “where ** is the exponentiation operator”.
> 
> Developers working on font-related tools tend to be familiar with Python, which uses ** (or pow()) for exponentiation, while ^ is bitwise XOR.
> 
> Best regards,
> Norbert
> Lindenberg Software LLC
> 
> 
> 
>> On Aug 30, 2020, at 21:58, Peter Constable <pgcon6 at msn.com> wrote:
>> 
>> https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit
>> hub.com%2FMicrosoftDocs%2Ftypography-issues%2Fissues%2F77&data=02
>> %7C01%7C%7Ca6670ba185804b73270708d84dd0e083%7C84df9e7fe9f640afb435aaa
>> aaaaaaaaa%7C1%7C0%7C637344906793030152&sdata=kueAMOx%2FNXQc%2Beu1
>> mcG1MpGmQB3VpOhOYb%2B0H5iwelg%3D&reserved=0
>> 
>> The notation “**” is not understood by some readers. It was reported by one as an error. The spec needs to be unambiguously interpretable by all.
>> 
>> 
>> Peter
>> 
>> From: Behdad Esfahbod <behdad at behdad.org>
>> Sent: Sunday, August 30, 2020 7:45 PM
>> To: Peter Constable <pgcon6 at msn.com>
>> Cc: MPEG OT Spec list (mpeg-otspec at lists.aau.at) 
>> <mpeg-otspec at lists.aau.at>
>> Subject: Re: [MPEG-OTSPEC] exponentiation (was RE: "font directory" / "offset table" / "table directory"
>> 
>> On Sun, Aug 30, 2020, 6:53 PM Peter Constable <pgcon6 at msn.com> wrote:
>> This describes symbols used in various languages:
>> 
>> https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fen.
>> wikipedia.org%2Fwiki%2FExponentiation%23In_programming_languages&
>> data=02%7C01%7C%7Ca6670ba185804b73270708d84dd0e083%7C84df9e7fe9f640af
>> b435aaaaaaaaaaaa%7C1%7C0%7C637344906793030152&sdata=iysHc07THMMtE
>> Vbsjk7CvVKD5xUI5cD2tHaKL3feSZc%3D&reserved=0
>> 
>> There isn't a perfect answer. I think the best answer is whatever would be most intuitive / less likely to be mis-interpreted.
>> 
>> Which happens to be "**". What's the problem again?
>> 
>> 
>> 
>> -----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://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis
>> ts.aau.at%2Fmailman%2Flistinfo%2Fmpeg-otspec&data=02%7C01%7C%7Ca6
>> 670ba185804b73270708d84dd0e083%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1
>> %7C0%7C637344906793030152&sdata=hvxO5hrOOSu4QSqGerFAnHQnVRYawyA9s
>> JwLI%2BF5uKU%3D&reserved=0 
>> _______________________________________________
>> mpeg-otspec mailing list
>> mpeg-otspec at lists.aau.at
>> https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis
>> ts.aau.at%2Fmailman%2Flistinfo%2Fmpeg-otspec&data=02%7C01%7C%7Ca6
>> 670ba185804b73270708d84dd0e083%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1
>> %7C0%7C637344906793030152&sdata=hvxO5hrOOSu4QSqGerFAnHQnVRYawyA9s
>> JwLI%2BF5uKU%3D&reserved=0 
>> _______________________________________________
>> mpeg-otspec mailing list
>> mpeg-otspec at lists.aau.at
>> https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis
>> ts.aau.at%2Fmailman%2Flistinfo%2Fmpeg-otspec&data=02%7C01%7C%7Ca6
>> 670ba185804b73270708d84dd0e083%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1
>> %7C0%7C637344906793040147&sdata=0IcuT8Fw8jES9AbXCeb4Q0iEA5RJTAyRJ
>> Ez7rZgVqA8%3D&reserved=0 
>> _______________________________________________
>> mpeg-otspec mailing list
>> mpeg-otspec at lists.aau.at
>> https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis
>> ts.aau.at%2Fmailman%2Flistinfo%2Fmpeg-otspec&data=02%7C01%7C%7Ca6
>> 670ba185804b73270708d84dd0e083%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1
>> %7C0%7C637344906793040147&sdata=0IcuT8Fw8jES9AbXCeb4Q0iEA5RJTAyRJ
>> Ez7rZgVqA8%3D&reserved=0
> 
> _______________________________________________
> mpeg-otspec mailing list
> mpeg-otspec at lists.aau.at
> https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
> s.aau.at%2Fmailman%2Flistinfo%2Fmpeg-otspec&data=02%7C01%7C%7Ca667
> 0ba185804b73270708d84dd0e083%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C
> 0%7C637344906793040147&sdata=0IcuT8Fw8jES9AbXCeb4Q0iEA5RJTAyRJEz7r
> ZgVqA8%3D&reserved=0

David Singer
Manager, Software Standards, Apple Inc.



More information about the mpeg-otspec mailing list