
Tofu – The opposite of a font - juanpotato
https://github.com/JuanPotato/Tofu
======
userbinator
_WARNING: PLEASE DO NOT RUN THIS CODE ON A HARD DRIVE, I 'M NOT SURE HOW LONG
IT WOULD TAKE. I USED A RAM DISK_

I haven't looked at the implementation, but this seems to imply it is very I/O
intensive and already takes a very long time in RAM. Yet, nothing about the
problem statement suggests it would be such a task --- it sounds like
something that could be very straightforwardly done completely in memory.

~~~
juanpotato
You're right and I should have added more details. fontforge only accepts file
paths and not strings sadly

~~~
monsieurbanana
Libraries to treat strings as files are pretty common, in python they have one
in the std:

[https://docs.python.org/2/library/stringio.html](https://docs.python.org/2/library/stringio.html)

~~~
juanpotato
But that's a file, it accepts a file path. I already looked into this

------
transitorykris
"This is stupid. Yeah probably, but for its very specific use case it's not
terribly bad."

Don't put your work down like this. You created something useful for yourself,
and likely useful for others. I'd be surprised if someone called it stupid.

~~~
djsumdog
Yea I was surprised at that too. This is incredibly useful for debugging and
trying to fiend weird security/unicode gotchas. I can think of a couple of use
cases this might be worth trying.

------
peterburkimsher
That's great! When I first started trying to learn Chinese, I had a problem
because I couldn't read the characters and sometimes couldn't copy-paste from
some apps. I made a font that was similar, and then I could use the Unicode
Hex Input keyboard. Your font looks so much better though!

~~~
juanpotato
Thanks dude!

------
mintplant
re: license, the SIL Open Font License is common and well-accepted.
[http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=...](http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL)

------
Retr0spectrum
> WARNING: PLEASE DO NOT RUN THIS CODE ON A HARD DRIVE, I'M NOT SURE HOW LONG
> IT WOULD TAKE. I USED A RAM DISK

How much disk IO does this program generate? Why?

In any case, the OS should cache stuff and give similar performance to using a
ramdisk, provided you have enough spare ram.

~~~
13of40
> the OS should cache stuff

When I worked at Microsoft back in the 90's I inquired around building 26 as
to why I couldn't create a ram disk on what was to become Windows 2000, and
this was basically the answer. So yes, if caching doesn't solve this then
caching hasn't been implemented correctly.

~~~
MichaelGG
What if you're using a program that fsyncs? And the filesystem isn't just
keeping writes cached and flushing only when full. So if I'm writing GB of
temp files, I'm causing tons of disk load which may impact other programs.
Can't seek to read while writing all my temp data...

~~~
Dylan16807
> What if you're using a program that fsyncs?

Remove the fsync or use libeatmydata.

> So if I'm writing GB of temp files

The kind that won't fit on a ramdisk in the first place? And this particular
use case shouldn't need that.

~~~
MichaelGG
The scenario is I'm running a DB on the same system as temp program. Also,
machines with many GB of ram are popular these days.

~~~
Dylan16807
If fsync on one file forces all other files to disk, then it is 100% an OS
performance problem.

If your temp files fit in ram along with running programs, then they _should_
stay cached. A ramdisk should only be needed in edge cases where you want to
manually force other things out of memory, or because you particularly want to
avoid extra writes to disk. In general performance is supposed to be boosted
just as much by caching.

~~~
MichaelGG
If your disk head is writing the temp file, then it can't be sitting idle
waiting to fsync. And it'll eventually write as part of checkpointing.

------
jfk13
Might be interesting to compare SIL's "Unicode BMP Fallback Font",[1] which is
significantly more compact (I believe it uses composite glyphs).

[1]
[http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=...](http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=UnicodeBMPFallbackFont)

~~~
juanpotato
I'm trying to find how to do this in fontforge

------
lifthrasiir
It is both reasonable and unfortunate that TrueType & OpenType fonts can have
no more than 65,535 glyphs. That said, probably the logical font made of
multiple physical fonts can be probably made to support all available planes.

~~~
userbinator
_That said, probably the logical font made of multiple physical fonts can be
probably made to support all available planes._

Yes, that's how you can fit all of Unicode into one "font" \-- use a
collection of fonts with at most 64K glyphs each:

[https://graphicdesign.stackexchange.com/questions/73166/what...](https://graphicdesign.stackexchange.com/questions/73166/what-
is-the-maximum-number-of-glyphs-an-opentype-collection-can-hold)

I'll leave it as an "exercise for the reader" to generate such a font.

~~~
djsumdog
Wow, I did not know about that limitation. That's pretty interesting.

------
edem
We had a bug some weeks ago which was caused by a missing `trim` and an
invisible chararcter. Our tester copied some text from a webpage which had
such characters. This font is helpful in those cases.

------
hobarrera
Does anyone know the name of the app that's listing/displaying fonts? It looks
pretty neat, and I haven't found anything good-looking like that for
Linux/*nix.

~~~
relyks
It's GNOME's font manager:
[https://fontmanager.github.io/](https://fontmanager.github.io/)

If you're using ubuntu, there's a package for it

~~~
hobarrera
Oh, thanks, cool.

It's designed with GNOME in mind, but not part of GNOME itself, so installing
it doesn't require pulling a huge part of GNOME either, and that's a nice
plus! :)

------
LoSboccacc
very nice! this should be the default binary view on many, many things,
especially debuggers/inspectors.

how does it handle combining characters? do they get everything in a single
box or are going to be rendered as two boxes?

~~~
juanpotato
They _should_ be treated as two separate boxes as I made it so that each glyph
is certain to be full width regardless of the default.

------
dgreensp
I feel like I'm missing the punchline. How big is the generated font?

~~~
juanpotato
~20MB

------
insulanian
I'd call it "Unfont" :-)

------
boltn
how would one go about running code/operations on ram as opposed to the hd?

~~~
Retr0spectrum
On most Linux distros, /tmp is a ramdisk.

~~~
JetSpiegel
But with only 1 GB capacity

~~~
glandium
It depends on your setup. The default when no size is given is to use half the
RAM.

~~~
colejohnson66
Half? That seems kind of excessive. Are you sure that’s right?

~~~
Sidnicious
I would guess that it’s given that capacity, but the memory is allocated
lazily.

~~~
yjftsjthsd-h
Correct; tmpfs only _uses_ as much memory as as is used by the files it
contains.

------
nicostouch
TOFU = Terrified Of Fucking it Up.

e.g I wanna try it but i'm TOFU

