Font_ReadDefn + Font_ReadIdentifier
John Tytgat
John.Tytgat at aaug.net
Tue Jun 17 23:25:17 BST 2008
I want some feedback on the following : currently we have SWI Font_ReadDefn
covered by OSLib's Font_ReadDefn definition which gets you the font
identifier (only fontname), point sizes, resolution, age and a usage count
for given font handle:
--8<--
Font_ReadDefn =
( NUMBER 0x40083 "Reads details about a font",
ENTRY
( R0 = Font_F: font "Font handle",
R1 = .Ref .Data: font_id "Buffer to hold font identifier",
R3 # 0
),
EXIT
( R2 = .Int: xsize,
R3 = .Int: ysize,
R4 = .Int: xres,
R5 = .Int: yres,
R6 = .Int: age,
R7 = .Int: usage_count
) ),
--8<--
There is an extension to SWI Font_ReadDefn when you call it with R3 = 'FULL'
which gives you the full font identifier (including all qualifiers used)
and above information as well (it also allows you to know the minimal
buffer length but that's not the point here). This extension is only
partially covered by OSLib's Font_ReadIdentifier as that will only give
the full font identifier and not the point sizes, resolution etc. while
that's perfectly possible with the Font_ReadDefn SWI with R3 = 'FULL':
--8<--
Font_ReadIdentifier =
( NUMBER 0x40083 "Reads the full font identifier by calling Font_ReadDefn with R3 = 'FULL'",
ENTRY
( R0 = Font_F: font,
R1 = .Ref .Data: buffer "if 0, then required buffer size is returned in R2",
R3 # 'FULL'
),
EXIT
( R2! = .Int: used,
R3?, R4?, R5?, R6?, R7?
) ),
--8<--
In order to avoid an extra SWI call when full font identifer needs to be
known and all other information as well, I propose to define the following
as a extra OSLib definition:
--8<--
+ Font_ReadFullDefn =
+ ( NUMBER 0x40083 "Reads details about a font including full font identifer (with qualifiers) by calling Font_ReadDefn with R3 = 'FULL'",
+ ENTRY
+ ( R0 = Font_F: font "Font handle",
+ R1 = .Ref .Data: font_id "Buffer to hold font identifier (may not be 0)",
+ R3 # 'FULL'
+ ),
+ EXIT
+ ( R2 = .Int: xsize,
+ R3 = .Int: ysize,
+ R4 = .Int: xres,
+ R5 = .Int: yres,
+ R6 = .Int: age,
+ R7 = .Int: usage_count
+ ) ),
--8<--
Any comments ?
John.
--
John Tytgat, in his comfy chair at home BASS
John.Tytgat at aaug.net ARM powered, RISC OS driven
More information about the oslib-user
mailing list