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

Kolaru compat with mathtexengine #1952

Merged
merged 28 commits into from
May 20, 2022
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
45485be
Use TeXChar common interface with FontExtent
Kolaru Mar 25, 2022
57f03db
Uniformize char and texchar with GlyphExtent
Kolaru Apr 19, 2022
283ab2f
Use TeXChar common interface with FontExtent
Kolaru Apr 19, 2022
e36aae3
Uniformize char and texchar with GlyphExtent
Kolaru Apr 19, 2022
299176e
Merge branch 'compat_with_mathtexengine' of https://github.com/Kolaru…
Kolaru Apr 19, 2022
1f4ccc3
Fix boundingbox for texchar
Kolaru Apr 20, 2022
c4c8f7b
Merge branch 'master' into compat_with_mathtexengine
ffreyer May 13, 2022
799476d
fix line position
ffreyer May 13, 2022
8f03716
fix @cell
ffreyer May 13, 2022
8236a5a
fix word wrap
ffreyer May 13, 2022
cec9dae
fix text bounding boxes
ffreyer May 13, 2022
e63080d
switch to ink_bounding_box
ffreyer May 13, 2022
13866bf
use character height instead of font height
ffreyer May 13, 2022
f9dfc09
tweak padding
ffreyer May 13, 2022
dbf59e2
Merge branch 'master' into compat_with_mathtexengine
SimonDanisch May 16, 2022
1ee9347
Merge branch 'master' into compat_with_mathtexengine
SimonDanisch May 17, 2022
6079966
Merge branch 'compat_with_mathtexengine' of https://github.com/Kolaru…
SimonDanisch May 18, 2022
cc84167
use height_insensitive_bb for chars
SimonDanisch May 18, 2022
54de463
revert to inkboundingbox for ink_bb
jkrumbiegel May 20, 2022
3859037
use height_insensitive_boundingbox_with_advance
jkrumbiegel May 20, 2022
4228de7
remove dead code
jkrumbiegel May 20, 2022
9580b87
improve test
jkrumbiegel May 20, 2022
dc8317b
use _with_advance everywhere
jkrumbiegel May 20, 2022
6857bf6
remove false namespacing
jkrumbiegel May 20, 2022
f957e6f
correct ascender / descender use in alignment
jkrumbiegel May 20, 2022
a1a7391
revert paddings
jkrumbiegel May 20, 2022
63abf38
Merge branch 'master' into Kolaru-compat_with_mathtexengine
jkrumbiegel May 20, 2022
9862b3c
remove now invalid test
jkrumbiegel May 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ end

function GlyphExtent(font, char)
extent = get_extent(font, char)
ink_bb = FreeTypeAbstraction.inkboundingbox(extent)
ink_bb = FreeTypeAbstraction.height_insensitive_boundingbox(extent, font)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes bounding boxes less accurate. Why not undo my changes instead? (use character height instead of font height)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is that way on purpose. text should not be bounding-boxed tightly around the glyphs, but given the font's ascenders and descenders. unless there is a specific purpose for having a tighltly bounded glyph, but normal text is not that

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the question is just if LaTeX should use something else because text is positioned all over the place there. I don't know how real LaTeX handles equation bounding boxes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ok I guess I misunderstood, the ink_bb should of course be the inkboundingbox, but that doesn't mean we have to use it to compute text boundingboxes. it's still useful to have in that struct

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another direction I thought about going with my changes was to use something like overallheight = max(font_height, max_height_of_line) for latex. I guess that would be the way if we want to keep text aligned based on the largest character/font rather than individual characters.

Maybe we should also just have both styles for alignments and bounding boxes. I.e. one based on characters and one based on the (if necessary padded) font (height)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally the font ascender / descenders shouldn't be that far off from normal strings that have the occasional f or g. Just some fonts define those metrics in a peculiar way (case in point, the need for TeX Gyre Heros Makie). So only if you were to do something where absolute precision of boundingboxes of strings was necessary would you need those other styles. I think in all other situations the non-jitteryness is preferable and seems to be what other text-based tools or browsers etc are doing.

ascender = FreeTypeAbstraction.ascender(font)
descender = FreeTypeAbstraction.descender(font)
hadvance = FreeTypeAbstraction.hadvance(extent)
Expand Down