Subject: Re: International wordprocessing. -Reply

From: "L.S.Ng" <[email-masked]>
Date: Mon, 21 Feb 1994 19:33:11 GMT

I am writing for example, a Chinese printf function and creating a
Chinese Function Library similar to prinf function in the Standard
Function Library.

This is my architecture:

scanf: workhorse is a tree search algorithm, which search the Chinese
character corresponding to a sequence of keys.

'printf': workhorse is an algorithm that looks up the bitmap correponding
to a Chinese character code, and copy it to a device (e.g. display or
printer)

As for scanf, the search is done through a 'Dictionary tree' (a kind of
extension to a binary tree)

As for printf, the bitmap is stored in a memory block called Font
Buffer.

As you can see, it does not really matter what the font file format is.
All we need to do is to scan-convert the font file into font bitmap
which is stored in the Font Buffer.

Of course if you are using display postcript, there is not need to
convert to bitmap.  I talk about bitmap because most display is bitmap
nowadays.

Or even you have a postcript file, the first thing to do is to convert
it to bitmap and store it in the font buffer. This is dynamic and can be
done on the fly.

> What one needs is one standard for fonts, that will work in any

Unfortunately in reality, o standard for font cannot be established.
There are already TTF, Postcript, Bitmap, and the latest Composite font.
Trend is changing all the time.

So to 'shield' the head-aching ever changing font format from the
Chinese printf() function, I thought out the design of Font Buffer,
which serve as a buffer between font files of various format and the
actual device format (e.g.  bitmap or postcript or vector).

Having said that, I have no objection with what you have said
about postscript.  I think the programming problem can be simplified
using Font Buffer, i.e.  to break the problem into two, (1) handling
font file (2) output to devices.  So you can help in writing postscript
scan-convert algorithm to bitmap, then I can concentrate on the second
part: bitmap to device.

You can also see the extra benefit here i.e.  various combinations of
font format and output format.  e.g.  If I have written a font
scan-convert algorithm for TTF, say, then the same Font Buffer can be
used for either Display or Printer!! On the other hand, if I also use
postscript, then I can use both TTF and postscript at the same time,
because they are sharing the Font Buffer!!

On the contrary, if you are not using Font Buffer, you then need to
write functions for each type of output and each type of font format.

If the previous case with font buffer we need N font algorithm + M
output algorithm = N+M algorithm, we would require N x M algorithms for
various combination of output and font format.

> As for libraries: I think that in systems like Windows, OS/2 and
> actually anything apart from DOS it would be more desirable to
> use Dynamic Link Libraries (DLL's). DLL's are not part of the

Yes, indeed. DLL should reduce the size of executables.

(Just a amusing thought: How come Windows programs get larger and larger
despite DLL and other OOP design? They are supposed to reuse existing
code, aren't they?)

---

From: "L.S.Ng" <[email-masked]>
Date: Tue, 22 Feb 1994 15:01:18 GMT

> I don't know if you really mean printf and scanf by word. They are namely

Of course not. I use 'printf' and 'scanf' to refer to the core
algorithm.

I am only interested in writing the core algorithm for printf and scanf.
And I plan to make them as macro or subroutine to a higher level
funtion, i.e. the actual printf or scanf. Similarly they can be tailored
to suit page-scroll display or interactive input (e.g. in wordpro system).

e.g.  the core algorithm of scanf is a function returning a pointer to
the GB code with a string of input sequence as argument.

e.g. the core algorithm of printf is a function that copy bitmap from
the font buffer and paste it into the image buffer at a given
coordinate.

It is then up to the programmers to tailor these core algorithm.

Of course, I will also write the printf and scanf itself, either as an
example or for use with writing 'small Chinese programs' such as 'type,
cat' .....

I am now writing the documentation which has roughly two parts.

i) how to use such core algorithm
ii) how to design such core algorithm for a given platform.

Sincerely
Liangsheng WU