-
Notifications
You must be signed in to change notification settings - Fork 0
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
Merged font bug: Wrong metrics and missing glyphs? #3
Comments
Could this be an error in the type1 font which is not present in the original metafont sources? |
AFAICT, the
|
The radical signs experience the exact same problem: Technical note: When the vertical content is of size n, the radical sign is of size n+1. Again, the intermediate size (numbered “4”, produced by “3”) appears to be vertically off-aligned (it should be slightly lower IMHO). On the other hand, the supposed These two phenomenons combined to create the “sudden deepening” of the radical signs, which is really unpleasing: % Insert the following code to the MWE above
\newcommand*\testsqrt[1]{%
\sqrtsign{%
\vcenter{\color{red}\vcontent{#1}%
\hbox{\smash{\color{blue}\the\numexpr#1+1\relax}}}%
}%
}
\(
\testsqrt{ 0}% From cmex10
\testsqrt{ 1}%
\testsqrt{ 2}% From cmex10
\testsqrt{ 3}%
\testsqrt{ 4}% NOT From cmex10 ???
\testsqrt{ 5}%
\testsqrt{ 6}% From cmex10
\testsqrt{ 7}%
\testsqrt{ 8}%
\testsqrt{ 9}%
\testsqrt{10}%
\testsqrt{11}%
\testsqrt{12}%
\testsqrt{13}%
\) |
Hmm, strange. Looking at the generated glyphs it does seem correct, though ...(running mf-nowin and gftodvi). What would you say? |
I’m afraid that my metafont knowledge is extremely limited. Yes, the glyphs do exist — TeX just doesn’t choose them… Could it be the problem with the chain of linking the next large delimiter? charlist oct"000": oct"200": oct"020": oct"201":
oct"022": oct"202": oct"040": oct"203":
oct"204": oct"205": oct"206": oct"207": oct"210": oct"211":
oct"060"; % left parentheses
... and the series of On the other hand, in terms of the metrics, at the (CHARACTER O 200
(CHARWD R 0.527781)
(CHARHT R 0.039999)
(CHARDP R 1.490013)
(NEXTLARGER O 20)
(MAP
(SELECTFONT D 1)
(SETCHAR O 200)
)
) Shouldn’t the
Right now |
Just searching around found that https://tex.stackexchange.com/questions/191632/latex-extensible-delimiters-definitions I need to read in detail, but being very busy till next week Wednesday I will not have a chance to look into it for now. |
dear all, thank you very much for your interest in |
Here is a somewhat thorough comparison between
The above list contains 102 slots that need to be fixed in the first 128 slots. If the correct metrics are used, then we should remove the 32 lines containing Again, I’m leaning towards a metric issue — I don’t think there are bugs in |
And here is my proposed metrics for the second-half (the remaining 128 slots): 1 and 2 are major, 3–6 are minor and 7–10 need no changes at all.
The above list contains 82 slots (50 of which need adjustments). The rest 46 slots are wide accents (10 |
I have prepared the new vplfile with the correct font metrics: yhmath-new-vplfile.txt This can be used as direct replacement from line 1937 to 4564 in the |
Thanks a lot for your work @RuixiZhang42 |
Ok, I did it already: The devel branch now contains the changes you mentioned, with updated .tfm, .vf, and .pdf of the documentation. |
@norbusan No worries. There is no reason to rush, considered the scope of this project, ;-) I had a few minutes to test my examples, here are the old versus new metrics results:
The conclusion I can draw is that the new metrics only fixes some of the problem… |
Hmmm… I took a look at % yhmath.dtx
L1209: --z2r---z1r--z1l---z2l--subpath (t,0) of\\(z3l{z9-z3}..z5r)
L1228: --z2r---z1r--z1l---z2l--subpath (t,0) of\\(z3r{z9-z3}..z5r)
L1232: "Extensible vertical arrow--extension module";
L1281: "Extensible double vertical arrow--extension module";
% versus bigdel.mf, respectively
--z1r--z1l--subpath (t,0) of\\(z3l{z9-z3}..z5r)
--z1r--z1l--subpath (t,0) of\\(z3r{z9-z3}..z5r)
cmchar "Extensible vertical arrow--extension module";
cmchar "Extensible double vertical arrow--extension module"; I’m suspecting |
Thanks for your analysis, indeed this is strange. Concerning |
@norbusan I can confirm that the metrics in The metrics in |
@RuixiZhang42 Unfortunately this is not the way to go with the pl. The tfm is generated from the metafont source, so one would need to make changes in the respective .mf files. FOr example, you changed char0 depth:
but this value comes from here
This is the very same definition as in the original I checked the generating mf files, Then I compared Checking the |
This is indeed very cryptic .. generating the cmex10.tfm which has NO changes with respect to char0, I get differences between the generated pl files:
And I have NO idea whatsoever where this might come from ... |
Ok, this is getting strange ... I removed every other change and only add the following code in
This should not change the size of other chars, but it does ... |
Yes, this is what I’ve suspected — that the TFM is directly generated from the MF.
As your discovered in later comments, the “correct” dimensions are taken from This is really bizarre… :( But I hope my “evidence” at least shed some light:
Side note: My proposed VPL file and yrcmex10-new.pl could serve as target dimensions; that is, the generated metrics should come close to the ones in my proposal. |
Yeah, I think your experiments are extremely valuable, but before doing any changes I need to know why the depths change in the glyphs, so that I understand the reason for all this ... |
Here we go, the answer is that mf only allows up to max 15 different depth values: https://tex.stackexchange.com/a/478144/10829 This is an interesting question, and one probably needs to think about how this can be circumvented. |
Can we simply remove the first 128 characters from |
I guess so, since the yhcmex10 can be build from the cmex10 and minimal yhrcmex10. I am not sure whether the limitation on depth applies also to tfm files generated from vpl. And one would need to make sure that the vpl contains the correct NEXTCHAR calls that match the |
Ahhh, it seems it won't work. Reading the explanation in the tex.sx answer it seems a format restriction in the tfm file format, thus also those generated from vpl will have these restrictions :-( |
Also, reading the output of the
:-( |
Ouch! Well, I guess the only option left is to reduce the number of glyphs… It’s a trade-off between wrong dimensions and fewer glyphs. I’d suggest to remove all intermediate sizes: 1.5em, 2.1em and 2.7em — they are not accessible via I’d also suggest to remove the largest size: 6.6em — if necessary. See, every row of a matrix is inserted with a strut by default, which means it’s about 1.2 times high as the font size. So a 5-row pmatrix would use 5×1.2=6em parentheses, while a 6-row pmatrix would use 6×1.2=7.2em parentheses. So going from 5-row to 6-row we would have straight parentheses anyway. In this regard, the 6.6em sizes are not usual as well. This saves 3 (or 4 if 6.6em’s are removed) depths. |
Instead of deleting some glyphs, you could try to exploit the height: TeX always uses This would break with the TeX tradition of using |
@zauguin But the radicals are in there :( Surely, this could work for the parentheses, angle brackets, slashes, etc. But the radicals must sink below the baseline… So that many depths are necessary if you want to keep all glyphs. BTW, the combined virtual property list |
I suggest something different: what about making one font only containing the cnex + yhcmex delimiters without the other cmex glyphs, so that we can do the charlist stuff. |
Actually, looking at the current code I don't see a need to include the So we would need separate fonts for separate delimiters, allocate two families, and use them. Should be doable. |
Splitting up the font is barely enough. Let’s do the count:
|
Okay, I think I’ve done it:
Voilà! If we just remove those 3 intermediate sizes, then we’d save 3 depths, which can then be given to Oct 70–76, problem solved… |
@norbusan I’m pleased to announce that I have combined both your suggestion (removing big operators) and @zauguin’s suggestion (exploiting heights). No need to remove further glyphs (yeah!!!). My strategies are:
These would be the minimal changes required and I’m very confident that this could work. The reference I’m using is Technical Report on Math Font Encoding by Justin Ziegler. In particular, Appendix C.7. |
How about making a series of fonts, where each font has 256 different sizes of a given symbol? (one font for the left parenthesis, one for the right, etc.)
Wouldn't that be the ideal solution? We would get a very smooth between sizes and would be able to have much bigger symbols.
Cheers
Yannis
Le 9 mars 2019 à 19:49, Ruixi Zhang ***@***.*** ***@***.***>> a écrit :
@norbusan <https://github.com/norbusan> I’m pleased to announce that I have combined both your suggestion (removing big operators) and @zauguin <https://github.com/zauguin>’s suggestion (exploiting heights). No need to remove further glyphs (yeah!!!).
My strategies are:
Removing big operators Oct 106–141.
Shifting Oct 14, 15, 60–67, 74, 75, 77–103, 164, 165, 167–171, 176, 177 up by 0.4pt, so that their depths can be shared with those of the radicals;
Shifting Oct 70–73 and 76 up by their total heights, so that they sit above the baseline. This only takes 2 heights space.
These would be the minimal changes required and I’m very confident that this could work.
mffileb-RZ.txt <https://github.com/TeX-Live/yhmath/files/2948741/mffileb-RZ.txt>
mffilec-RZ.txt <https://github.com/TeX-Live/yhmath/files/2948743/mffilec-RZ.txt>
vplfile-RZ.txt <https://github.com/TeX-Live/yhmath/files/2948744/vplfile-RZ.txt>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#3 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAtxffxLYTDfckDvt7KNWGRcZepDgiqYks5vVAIdgaJpZM4bSUo0>.
<http://www.imt-atlantique.fr/> Yannis HARALAMBOUS
Professor
Computer Science Department
UMR CNRS 6285 Lab-STICC
<http://perso.telecom-bretagne.eu/yannisharalambous/> <https://twitter.com/y_haralambous> <https://www.linkedin.com/in/yannis-haralambous-5529073?trk=hp-identity-name>Technopôle Brest-Iroise CS 83818
29238 Brest Cedex 3, France
Une école de l'IMT <http://www.imt.fr/>
Be sure to never split an infinitive.
Prepositions are bad to end sentences with. (Ivan Sag & Thomas Wasow)
|
@yannis1962 That doesn't solve the problem: There would still be only 15 different heights/depths, so it would not allow much more variants than the current font. For non-radicals you could use some height tricks, but especially for radicals this would give you only a minor benefit. Also then every character would need a TeX mathfont and TeX only allows 16 math fonts to be used at once with quite some of them already used for other stuff. |
Well, the good news is that after shifting up, running The other good news is that all “one-piece” size variants are now fully functional. … and the bad news is that TeX does not like how I shift up the extensible pieces: Any ideas, @zauguin ? |
Wait… @norbusan Could you rebuild |
@RuixiZhang42 Thanks a lot for your work, I tried with your updates mf/vpl files and the metafont font instead of the type1, but there is an error in the extensible parenthesis, see the following image. THere is a gap: |
The problematic case with the extensible brace - did it happen with type1 font of metafont? I cannot reproduce it here. BTW, your changes are in the devel branch if you want to hack further. If you have a github account, I can add you to this project so that you can make changes yourself. |
Yes, for type1. I’m self-taught a whole new language so I can be wrong… I couldn’t figure out how to build a
This also happens with square brackets, floors, ceilings after size-7 and radicals after size-13. Gaps appear to be present for all extensible sizes. My theory is on the instruction (SELECTFONT D 0) which takes glyphs from Could you test whether replacing all |
Just a quick question @RuixiZhang42 I was reading again the changes of the glyphs, like
But ... don't we have to also adjust the actual drawing if we shift the sizes? I mean, we draw on a certain area but the used clip window is shifted upward. Isn't that the reason that the glyphs have now the open gaps? And, shouldn't also the appearance (vertical position) of the other glyphs (not expandable ones) be slightly different due to the shift? |
PS: this was with the MF font (pk glyphs), not the pfb, so it is irrelevant from the pfb/type1 font! |
Any progress? |
Not really |
I dug a little further from our discussion on the “slightly larger intermediate parentheses”. In my previous comment I mentioned that
This appears to be a
yhcmex10
font bug after all. In the following example, I found that:\Big
and\bigg
, were vertically off-center (metrics wrong?);\bigg
sizes — numbered “5” — were stuck at the previous smaller sizes and did not grow (glyphs missing?). The vertical placements were also wrong.The second point now fully explains why TeX chooses the larger (and unpleasing) parentheses in
\binom
: TeX was supposed to choose\bigg
, but it turned out that\bigg
was mis-mapped to a smaller size and was not big enough. So TeX proceeded to the next bigger size available, the intermediate one (numbered 6, between\bigg
and\Bigg
).I have highlighted the problematic sizes in orange.
The text was updated successfully, but these errors were encountered: