[fpc-pascal] TurboVision is reborn as FOSS (again)

Marco van de Voort fpc at pascalprogramming.org
Tue Dec 22 11:13:54 CET 2020


Op 2020-12-22 om 00:42 schreef gabor via fpc-pascal:
> W dniu 2020-12-21 o 23:41, Sven Barth via fpc-pascal pisze:
> > The main restriction is that it only supports ShortString and thus has
> > no Unicode support.
>
> I wonder which type would be best suited to store a unicode character 
> (code point) for the screen buffer?
>
> type
>   TScreenBuffer = array of record
>     Character: TypeForUnicodeCodepoint;
>     AttributeAndColor: TAttributeAndColor;
>   end;
>
>
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.

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.




More information about the fpc-pascal mailing list