W dniu 2020-12-22 o 11:13, Marco van de Voort via fpc-pascal pisze:
The problem is that multiple unicode codepoints might translate to one character. But that character might have variable width (1, 1.5, 2). And the rendering of codepoints to characters is output device (terminal, GUI canvas) dependent.

Sorry, I keep mistaking code point for character. I thought that the code point is a value in the range 0..10FFFF. I don't think I fully understand Unicode...

First and for all, I would keep the buffer private. This allows to keep the buffer in a format suitable to quickly convert to the output device, and access won't be simple array like anyway. This also abstracts final writing API and end device encoding.

Maybe have multiple arrays, one for one codepoint per character, and one larger ones for additional ones.

This way you can simply scan the larger array if there are additional ones, and if not, emit the primary one in a straightforward way.

But an off-screen drawing buffer would also be useful. For example, FV uses such a buffer to draw views (TDrawBuffer = Array [0..MaxViewWidth - 1] Of Word). Buffer declared as an array of records with character and color elements could be easily and quickly drawn in another buffer.

Michał.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to