Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions concerning subscripts and superscripts in the PUA #135

Open
anderslundstedt opened this issue Mar 17, 2022 · 15 comments
Open

Questions concerning subscripts and superscripts in the PUA #135

anderslundstedt opened this issue Mar 17, 2022 · 15 comments
Labels
enhancement may be implemented as an enhancement

Comments

@anderslundstedt
Copy link

Looking through the PUA I found, to my great delight, lots of superscripts and subscripts. Some questions regarding these:

(1) Some code points are assigned identical (to my eyes, at least) glyphs. See picture below. What is the point with this?

(2) Is the code-point-to-character mapping for these considered stable? (What I mean is: could a future version of the font move or remove some or all of these subscripts and superscripts?

(3) Any chance of getting more superscripts and subscripts? A killer feature for math typesetting would be superscripts and subscripts for each character of the Mathematical Alphanumeric Symbols block. (When typesetting math, I mainly use the sans-serf italics for latin letters—code points 1D608–1D63B—and the italics for greek letters—code points 1D6E2–1D71B. So for me just those as superscripts and subscripts would be a killer feature.)

(4) In stevengj/subsuper-proposal#7 (comment) you demoed a way to input subscripts and superscripts using variational selectors. That never went into any release, right? If not, would you consider it?

Untitled

@anderslundstedt
Copy link
Author

And as always, thanks for a terrific font!

@cormullion
Copy link
Owner

Hi Anders! Thanks as always.

Re (1) The earlier glyphs (UE8...) were added first; then the bigger set was added later as part of my contribution to https://github.com/stevengj/subsuper-proposal/. There's a loose 1:many relationship between the glyph designs and the Unicode points in the final font file: you can have the same glyph appearing in multiple places and in different positions and orientations, with many Unicode values. The PUA is unstructured, but there's probably no good reason to keep changing it... :)

Re (2) The Unicode values won't change until there's a better place to put them. If Professor Johnson's proposal ever gets accepted (unlikely), and the Unicode Consortium designate some new permanent locations for them (unlikely), then they will of course move there - but they could be copied there and kept in their old locations as well, that's no extra work.

Re (3) Can't rule it out! Although the differences between all these characters in subscript format might be difficult to distinguish at typical "coding" sizes.

Re (4) I made a temporary change to access the Variational Selector glyphs locally but disabled it quickly afterwards, because the font shouldn't be breaking Unicode rules when released to users. Also, the Variational Selector mechanism is now being used to access Math script alternatives (#124), which can be in the next release, as soon as it's officially supported by the Glyphs fontmaker. If the official Variational Selector mechanism works well, we can see if a similar mechanism for subscripts can be added without any problems. Of course, should the Unicode Consortium choose the Variational Selectors mechanism to implement Professor Johnson's proposal (unlikely), that would be even better. Until then, some kind of macro or keyboard shortcut mechanism might work.

@stale
Copy link

stale bot commented Mar 25, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions!

@stale stale bot added the stale label Mar 25, 2022
@anderslundstedt
Copy link
Author

Perhaps my wish will not be forgotten whether this issue is closed or not, but as I said I would definitely love some superscripts and subscripts based on the glyphs for the Mathematical Alphanumeric Symbols.

As I almost said in my original post (where I included some code points I do not use) from that block I mainly use 1D608–1D638, and those not-latin-looking greek letters that are in the range 1DE62–1D714—I think these best match with how the standard variants of these characters look in this font.

@stale stale bot removed the stale label Mar 27, 2022
@cormullion
Copy link
Owner

Hi Anders - I’ll label this as enhancement so it stays open, but don’t know when it will happen. 😀

@cormullion cormullion added the enhancement may be implemented as an enhancement label Mar 27, 2022
@anderslundstedt
Copy link
Author

anderslundstedt commented Mar 27, 2022

No expectations from my side! I am delighted by the already existing superscripts and subscripts!

@DanielMGessel
Copy link

I would like to second interest in this - the orthogonality would work well within the tools I am constructing. I have found https://pypi.org/project/fonttools/ useful and might be able to prototype this in ttf. With permission, I could share an “extension font” (only the original glyphs and the PUA code points with scaled and translated instances to super/sub-script locations) with interested parties. My optimism here is that I was able edit the ttx xml with Emacs and convert back into a ttf font a single glyph that instances super and sub scripted 0s to represent a “byte value 0 hex digit pair”. I haven’t yet automated this nor done any scaling and translation in building a ttf combo glyph, so I can’t commit to a timeline. Let me know if this is of interest…

@cormullion
Copy link
Owner

Hi Daniel!

According to the SIL licence, you don't need permission for anything, so you really can do what you like - the only real restriction is that you can't use the reserved name JuliaMono for any derivatives. "GesselMono" would be fine... :)

One comment is that subscript and superscript glyphs are distinctly different glyphs, not transformed versions of others. So the top one here is scaled and moved, the bottom one is redrawn:

91992376-f94a6380-ed2b-11ea-9d13-a083dde22aac

@DanielMGessel
Copy link

Great! I'll put this somewhere on my todo list. When I'm ready to share, I'll create a repo including the Python scripts. I'll try to honor any recommendations for PUA placement, but the scripts will make it easy to relocate (names too, if you don't appreciate GesselTheGreatsMono as a font name). I do realize the subscripts are "tuned" for their smaller size - aside from tools limiting me to ttf fonts, this is the main reason I only offer to prototype the feature as the design work to do it properly is beyond me.

@anderslundstedt
Copy link
Author

As for (3) in my original post, I have toyed around with the idea of making alternative regular versions font, replacing all superscripts and subscripts with their counterparts from the their italic versions. Here is JuliaMono Light mathematical alphanumerics with superscripts from JuliaMono Light Italic (both v. 0.045):

Screen Shot 2022-09-15 at 13 35 41

@DanielMGessel
Copy link

@anderslundstedt It’d be interesting to know if you could make use of a prototype? Creating a subset ttf font - containing only italic super/sub scripts - is straightforward with the Python fonttools package. If your toolset allows for control of fallback for missing glyphs, you could set the subset font as primary, the real font as fallback.

@anderslundstedt
Copy link
Author

My main use of JuliaMono is for typesetting mathematics. So far I have used a simple script doing:

plain text → TeX source → PDF.

The step from TeX to PDF uses XeLaTeX. I very quickly googled for the possibility of using a fallback font with XeLaTex. It does look possible, but perhaps it is not as straightforward as one would like.

Any idea how much more difficult it would be to merge

  • the subset of JuliaMono Regular (say) that includes all glyphs except for the superscripts or subscripts

with

  • the subset of JuliaMono RegularItalic that has only the superscripts and subscripts?

@DanielMGessel
Copy link

I started hacking out a bash script that uses the fonttools Python package.
It looks like it successfully (tested with font-manager under Ubuntu) merges Regular with RegularItalic's PUA su[pb]scripts in a couple of steps. Hunting down the hex ranges for all the myriad scattered codepoints is TBD, but they can be included as comma separated ranges or individual hex values. It doesn't rename the font properly, I think going to ttx (an XML format of the ttf file) and doing a search-and-replace may be the way forward there.

@anderslundstedt
Copy link
Author

Thanks! One small problem for my use case is that the italic glyphs for superscripts ‘a’, ‘g’ and ‘r’ do not match the glyphs from the Mathematical Alphanumerics Block I mainly use when typesetting mathematics. For ‘a’, ‘g’ and ‘r’ I use sans-serif italics─see

https://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols

─since I think these best match the style of the rest of the JuliaMono typeface.

(For the case of italic superscript r, it does not respect the “alternate r” stylistic set, so that may be considered a bug, probably to be added to #126. But then there are other similar bugs that my use case benefit from, such as that the superscripts of ‘γ’ all look much more like the sens-serif italic γ from the Mathematical Alphanumerics than they look like the regular γ.)

In any case, I will have closer look at FontTools and also how fonts work to see if there are some convenient workarounds for my case.

Copy link

github-actions bot commented Dec 7, 2023

This issue has been open for 30 days with no activity.

@github-actions github-actions bot added stale and removed stale labels Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement may be implemented as an enhancement
Projects
None yet
Development

No branches or pull requests

3 participants