Text-mode apps (Was :Who are the "spacists"?)
rosuav at gmail.com
Sun Mar 26 15:53:12 EDT 2017
On Mon, Mar 27, 2017 at 6:25 AM, Mikhail V <mikhailwas at gmail.com> wrote:
> On 26 March 2017 at 20:10, Steve D'Aprano <steve+python at pearwood.info> wrote:
>> On Mon, 27 Mar 2017 03:57 am, Mikhail V wrote:
>>>>> And more important: can one use binary (bitmap) fonts in default modern
>>>>> linux console? If yes, can one patch them with custom tiles at
>>>>> the application start?
>>>> If you really need something completely custom, it's not text any
>>> Obvious fact, but if I need e.g. rounded corners in table drawing
>>> characters? Or I just want to fix some characters which look especially
>>> ugly? Create a new TTF? No, thanks, this would be worst nightmare to
>>> do without a special tool (which have prices with several zeros, otherwise
>>> just don't work and can even break things system-wide)
>> Don't be silly. It took me ten seconds on Google to find this:
> It takes you ten seconds to Google, and what if I ask you
> to take, say Courier New font TTF file (which includes not only
> vector information but all that is responsible for bitmap
> rendering, subpixeling, etc), then edit one character (and
> all corresponding information for subpixeling),
> then compile it as a new font, then install it on Win,
> without that making any conflicts, and without _any_
> further glitches or changes in other characters, and no such
> things across all applications.
> If you'd try that, and you will succeed, _then_ I will publicly admit
> that I was silly.
> And paying even 50$ for correcting one glyph... well
> probably I'll do it if one gives guarantee that all above
> will work.
See previous comments about font substitution. Create a font with just
one character in it. Use that font in your application. Voila! No
changes to any other applications (because they'll still be using the
original font), and no changes to any other characters.
However, I'm impressed that you found a bug in a well-used font.
Is it that decades of typographical research is incorrect, or that the
designers of this font just sucked? You're pretty unambiguous in your
description that you are "correcting" a glyph. Not adapting it to your
own purposes - you're correcting something that's fundamentally wrong
in someone else's font. Impressive.
>> Why? Because you think you know better than the thousands of professionals
>> who have worked with text formats for decades?
> Sounds provocative, but yes, in some cases I know what I am
> doing ;-).
> But that is not because professionals does not know,
> there are many other aspects which come in play here.
> It depends on the use case, Unicode solves only some
> I was talking only about _my own_ usage, it
> will be obviously incompatible e.g. for copy-pasting
> between othr apps.
> There are benefits to store language-specific values (+ their glyphs)
> in separate stacks.
> Anyway this discussion will require concrete
> examples and much deeper investigation.
I generally find that when people say that Unicode doesn't solve their
problems and they need to roll their own, it's usually one of two
1) "Their problems" are all about simplicity. They don't want to have
to deal with all the complexities of real-world text, so they
arbitrarily restrict things.
2) Unicode _would_ solve their problems, they just don't realize it.
So if you're rolling your own text display system, you should start by
making a signed declaration:
I, the undersigned, acknowledge that my program is intentionally
excluding everyone who does not fit the following requirements:
[choose all applicable]
[ ] Speaks English exclusively
[ ] Uses no diacritical marks
[ ] Writes all text top-to-bottom, left-to-right
[ ] Uses only characters from the Basic Multilingual Plane
[ ] Uses only characters from this codepage: ____
[ ] Uses a monospaced font
[ ] Uses a proportionally-spaced font
[ ] Uses this font: _____________
[ ] Uses a mouse
[ ] Uses a keyboard
[ ] Other: ___________________
(use additional pages if required)
Sure, there are good reasons to place restrictions on people's text.
But those restrictions are part of your public API and UI. Acknowledge
them. Own them. And justify them.
>>> And for own standalone app, I would not use any TTF or
>>> anything vector-based font, since why?
>> Right, because your users will *love* to see their native language displayed
>> in a crappy bitmapped font with jagged or blurry edges.
> I am working on text rendering algorithms an have prototyped
> several bitmap-based text rendering algorithms,
> both managed and prerendered approaches, and there
> is _nothing_ jagged or [incorrectly] blurred there, when
> one knows what he's doing of course.
> So it would be _very_ hard to catch me on incompetence
> here, but you can try, and feel free to do it :))))
Sure. Render me two characters on a half-meter-wide 1920x1080 screen.
I'll choose the exact size dynamically, at run-time, in response to
the amount of chrome I have on the window. Make sure the two
characters look perfect whether I make this a tiny marker on the
screen, or make it completely fill the entire monitor.
> FYI vector-based fonts were mainly motivated by print design.
> Modern GPUs have capabilities for fast vector
> glyph rendering, but it is not needed for screen rendering,
> much less when higher DPI displays will prevale.
Even if high-DPI displays *do* prevail, you still have to render text
at a wide variety of pixel sizes. One character might have a box 10x19
pixels (that's what my MUD client is saying; the height of 19px is
what it's using from line to line, and the estimated 10px width is
based on the letter "n", and is used to convert from server-side
character widths to actual measured widths), or it might be stretched
to 568x1080 to fill the entire height of my screen. That letter might
get rotated by 7.3 degrees counter-clockwise in order to place it
tastefully into a logo. It could even be picked up and turned into a
three-mile-high 3D object in a fully-rendered world, helping to spell
out "SHARE AND ENJOY". Can your bitmapped font renderer handle all of
(If it can't, maybe it should go stick its head in a pig?)
More information about the Python-list