-
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
Text-based lookup does not seem to work #5
Comments
That is not the expected behavior. Please provide your typst code and the output pdf (an image capture is enough) to help me reproduce this problem.
|
I might find out why the ligature is not working in v0.2.0. Currently, the implementation of #let fa-icon(
/// The name of the icon.
///
/// This can be used with the ligature feature or the unicode of the glyph.
name,
/// Whether the icon is solid or not.
solid: false,
..args
) = {
text(
font: (
"Font Awesome 6 Free" + if solid { " Solid" },
"Font Awesome 6 Brands",
),
weight: if solid { 900 } else { 400 },
name,
..args
)
} Thus, I need to figure out how to fix this. Helps needed. |
One solution could be to rely on something other than ligatures, like using many if-else blocks to render the correct icon... |
Does |
I think the latest image shows that typst used its font fallback mechanism and rendered an incorrect glyph. Could you provide the output of It should be something like: $ typst fonts | grep Awesome
Font Awesome 6 Brands
Font Awesome 6 Free
Font Awesome 6 Free Solid |
I assume the icons come from some nerd fonts that integrated several font awesome's glyphs. Typst looks up fonts in the system directory and custom path. Could you set up the fonts, make sure that typst can find them, and try again? |
...I didn't notice the package doesn't magically bring along the font 🤦♂️. That's what I get for not paying attention to the README. It works for me now! Thanks for catching that the glyphs came from Nerd Fonts, I was wondering why my facebook icon looked different from the default FA one. Sorry @kaimast , not sure if I ended up hijacking your thread for an unrelated but similar-presenting issue. |
I have an idea of how to fix this and want to hear some feedback:
#let fa-icon(
name,
solid: false,
fa-icon-map: (:),
..args,
) = {
text(
font: (
"Font Awesome 6 Free" + if solid { " Solid" },
"Font Awesome 6 Brands",
),
weight: if solid { 900 } else { 400 },
// If the name is in the map, use the Unicode from the map
// If not, pass the name and let the ligature feature handle it
fa-icon-map.at(name, default: name),
..args,
)
}
In this way, the icon name is first looked up in the map. If it is found, the Unicode is used and should render the correct glyph. If it is not in the map, it is passed to I think this should solve the problem @kaimast met and might partially solve the problem mentioned in #2. |
After upgrade to 0.2.1 version (tomowang/typst-twentysecondcv@1c6cec1), now I can just use the This fix seems to bypass the ligature issue mentioned in typst/typst#2578. |
I haven't heard of any similar problem for three weeks. I assume this issue is fixed for Free and Brand sets. Close for now. |
The following works fine
#fa-envelope
. But#fa-icon("envelope")
just renders the text envelope.Similarly,
#fa-icon("github", fa-set: "Brands")
does not work but#fa-github(fa-set: "Brands")
does.Is that expected behavior? If so, the README migth be outdated.
I am on Arch linux with typst 0.11 and Font Awesome 6 installed from pacman. I use "@preview/fontawesome:0.1.0" to import this package. Happy to help debug this.
The text was updated successfully, but these errors were encountered: