Had a bit of spare time on the train last night, so decided to look into this a bit further ....
I did a dump of a few text entities to locate the fields related to TTF/SHX fonts. I thought I would find the fields that were declared in the D4D record (txtdisplayttf, TxtWinfont), but it was not exactly as I expected. There were 2 significant bytes in the record that differed between the SHX and TTF entities:
A hex dump of the relevant part of the entities is shown below
As you can see bytes at offsets of #185 and #186 (389 and 390) are different. I expected to see txtdisplayttf information in the record immediately before TxtWinFont but it was not as expected.
The txtdisplayttf field has the following structure:
Code: Select all TDisplayTTF = packed record
dooutline: boolean;
dofill: boolean;
OutlineClr: aSInt; { Range 1..255 }
FillClr: integer; { Range 1..255, Add 1000 Offset to fixed RGB }
end;
I tried looking at TTF text entities with different outline and fill properties, but the entity dump did not change. What I did find was that in addition to the fields in the entity record there are also attributes used to define the font:
SHX entities had an attribute named
Text.ShxFontName.
TTF entities had 2 attributes named
Text.WFFontName and
Text.TTFProp Although I have not tested, it would probably be possible to create a TTF Font entity using Classic DCAL by modifying the bytes at offsets 389 and 390 and adding the Text.WFFontName and Text.TTFProp attributes (and removing the Text.ShxFontName attribute) - this would probably need to be done after creating the SHX entity (i.e create the SHX ent and then modify it to change to desired TTF).
The code that I wrote to examine the entities is shown below (similar variant record could be used to modify the appropriate bytes of the entity record). I do not hold this up as an example of good programming (there is little error checking)!
Code: Select allPROGRAM TestFont;
TYPE
EntOverlay = RECORD
i : integer;
CASE integer OF
0 : (e : entity);
1 : (o : array [0..833] of byte); {I exstablished this as the size of the entity record using the sizeof function }
END;
VAR
entrec : EntOverlay;
res, key : integer;
mode : mode_type;
addr : entaddr;
i, j : integer;
ch : char;
fl : file;
BEGIN
selecttype := 1; {entity}
if getmode ('analyse as text entity', mode, key) = res_normal then
addr := ent_first (mode);
if ent_get (entrec.e, addr) then
i := f_create (fl, 'TextEnt.txt', true);
for i := 0 to 833 do
j := f_wrchar (fl, entrec.o[i]);
end;
i := f_close(fl);
wrterr ('TextEnt.txt file has hopefully been written');
else
wrterr ('Unable to read entity (Macro exits)');
end;
else
wrterr ('No entity selected (Macro exits)');
end;
END TestFont.[code][/code]
Note that to find attributes you can use the AttributeMgr macro available for download on my web site (although it is not a lot of help in displaying the value of attributes that are not text (even 'text' attributes can contain non-textual information - this is the case for the Text.TTFProp attribute mentioned above)