Comments (3)
My first thought would be to say that this is out-of-scope for uni. I think a "query font information from the commandline" would be a neat tool, but I'm not sure if it should be integrated in here. While Unicode and fonts are related, they're quite different domains.
With a hypothetical glyph
tool you could do something like:
$ uni -q p U+2042 | glyph
I don't know if something like that exists, but it shouldn't be too hard to modify your Perl example to read from stdin.
You can get the same information with fc-cat
by the way, which includes the charset
ranges.
Maybe I'll write the glyph
tool, or maybe I'll change my mind and add it uni anyway ... I'll have a think about it. We'll need configurable columns first anyway.
from uni.
@arp242 That is totally reasonable. Having that sort of functionality would be very useful for tasks relating to configuring polybar, powerline, etc. applications which tend to use unicode glyphs that are often highly font-specific, however, that doesn't mean that uni necessarily the best place to support such a feature.
Thanks for the suggestion regarding fc-cat
! That is one of the fontconfig tools I hadn't looked at before.
Sounds good though -- I'll leave the issue open for now.
from uni.
I looked a bit at this today, and it's kinda hard to get a good overview of this as far as I can tell. One of the bigger problems is that I can't figure out how to determine if a font supports a particular emoji (only codepoints, but emojis consist of more than one codepoint).
Adding a font parsing library would be too much IMO, not in the least because many of them only deal with one particular font, so to support TrueType, OpenType, Type1, raster fonts, etc. and it would require adding list of libraries; I also can't really figure out how to get this information from reading the docs and many libraries for Go seem unfinished and unmaintained.
In short, the entire thing would be a project into itself. It's extremely unlikely I'll ever do this, so I figure I might as well close this.
I did manage to cook up a little script for fc-cat
(but it doesn't deal with emojis); not very polished but I figured I might as well post it here. If someone can figure out how to get the emoji data from this too then I don't mind adding it to the repo, but I'd rather not add something half-working.
#!/bin/sh
set -euC
font="$(fc-cat 2>&1 | grep -Ei '^"dejavusansmono.ttf[^"]*?"')"
charset="$(printf "$font" | grep -Eo 'charset=[a-f0-9 -]+')"
charset="${charset#charset=}"
char=2e22
#char=2e1f
#char=6e1f
char_dec=$(printf '%d' "0x$char")
IFS=" "
for c in $charset; do
case "$c" in
*-*)
start="$(printf '%d' 0x${c%-*})"
end="$(printf '%d' 0x${c#*-})"
if [ $char_dec -ge $start ] && [ $char_dec -le $end ]; then
echo "U+$char is supported by this font"
exit 0
fi
;;
*)
if [ "$char" = "$c" ]; then
echo "U+$char is supported by this font"
exit 0
fi
;;
esac
done
echo "U+$char is NOT supported by this font"
exit 1
from uni.
Related Issues (20)
- Add a -v (version) flag HOT 3
- Custom columns HOT 4
- Give control over which variation selectors to print
- Allow copying to clipboard HOT 3
- Use embeded SQLite? HOT 2
- allow search to return all HOT 5
- Search by utf8? HOT 5
- Make v2 installable via "go install" HOT 7
- Support listing by derived properties HOT 1
- installation fails with " t.Cleanup undefined (type *testing.T has no field or method Cleanup)" HOT 4
- Build fails because https://arp242.net/termtext is 404 HOT 7
- MELTING FACE emoji is not visible in `uni i` HOT 2
- Building fails due to error in zli dependency HOT 5
- Add csv to printing format (-as flag) HOT 4
- clear whitespace at start of args HOT 2
- wasm-exec niceness HOT 3
- Thank you! + new integration HOT 3
- `uni list` - `from` and `to` are identical HOT 1
- identify: Uni is discarding Space, Tab and Newline characters HOT 2
- Please update the golang.org/x/sys dependency
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uni.