|
5. Cloning Firefox Webfonts |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Shape And Size Of WebfontsOnce TrueType fonts, and in particular webfonts, are installed on your Pegasos, all the problems concerning DTP programs are solved. Actually, in a wordprocessor you decide the size, style, and type of all the fonts used: possible balancing problems among these fonts can be solved directly by you according to your taste. If you want to clone a document produced on another computer, you can adjust the fonts by hand, until the result is reached, and usually you do not need universal solutions. On the other hand, problems concerning browsers are more complex, because you need a general strategy that should compensate any font difference automatically and once for all. In fact the goal, in this case, is cloning (within strict limits) the aspect of HTML pages displayed by another browser that runs on another computer (possibly of a diverse platform) under a different OS, with a distinct font engine. Such an ambitious goal requires major efforts, but the result can be achieved. Of course our interest is concentrated on font rendering and display on the PC/Windows and Pegasos/MorphOS platforms. Essentially the problem reduces to the fact that glyphs of the same webfonts, displayed with the same number of typographical points, can be different on the two platforms in terms of shapes and on-screen sizes. The shape problem was already solved implicitly in the previous section. The use of the "USWin ascender" metric for TrueType fonts ensures that you obtain the same shapes for all the glyphs on the two platforms. This is an experimental result: try other metrics and you will see sensible differences in terms of horizontal or vertical deformations. Therefore we remain with only one problem: given the same monitor size and screen resolution, obtaining the same actual on-screen size for the same font on PC/Windows and Pegasos/MorphOS. The most common causes of discrepancies can be classified in two classes that require distinct compensations.
The most simple solution for absolute size compensation requires that a specific font and point size are chosen as a reference on the first platform, and that their equivalent counterparts are found on the other platform. Then, all the other possible absolute sizes for this and the remaining fonts can be obtained by means of suitable size shifts and/or scaling factors. The font I used for this strategy is the most common default proportional sans-serif font, that is Arial. Firefox preferences (Tools » Options » General » Fonts&Colors) offer a basic range of sizes for this standard webfont: 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 40, 44, 48, 56, 64, 72 Arial glyphs are thin for small sizes and thick for large sizes, with the transition occurring when typographic point size jumps from 17 to 18. Size 17, that marks the largest thin Arial glyphs on the PC/Windows platform, can be used as an absolute reference. On the Pegasos/MorphOS platform, the transition from thin to thick glyphs (of an Arial font installed and generated according to the standard procedure described in the previous section) occurs when typographic point size jumps from 21 to 22. It is easy to check that the on-screen size of Arial 17 on PC/Windows is exactly equal to the on-screen size of Arial 21 on Pegasos/MorphOS. Actually, this difference of 4 points changes along the whole basic range of sizes reported above. With some patience, it is possible to verify that general equality of the on-screen size for the Arial font can be obtained by adopting the following basic range of sizes on the Pegasos/MorphOS platform: 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 24, 26, 28, 32, 34, 36, 38, 40, 42, 46, 52, 58, 66, 76, 86 Assume you use Firefox preferences to set the basic typographic size 17 for the Arial font. Then Firefox will display the standard size of the 7-step HTML scale (i.e. size 3) with this typographic size. Firefox will also generate automatically specific values for the typographic sizes of any other step of the HTML scale (by means of inner preset scale factors). You can see these HTML sizes and the relevant HTML declarations in the picture below (the page from which the picture was grabbed and cropped is generated by this HTML file).
![]() The correspondent procedure for setting font preferences in Amiga browsers is more boring, because an automatic scaling routine is absent. The user must choose the basic typographic size that must be adopted for the standard HTML size of the Arial font, and even the typographic sizes that he wants to associate to the other six HTML sizes. Actually, in the present case, this is an advantage because it is possible to proceed by means of trial and error through manual insertion of typographic sizes. In the end, we find the values that clone the on-screen sizes shown in the previous picture. You already know that the standard HTML size (matching size 17 on a PC) should be displayed by typographic size 21, the others are shown in the following table:
The actual procedure you should follow for inserting new font
configurations in your Amiga browser (AWeb, IBeowse, or
Voyager) was described in a previous subsection. The names that
should be used for a correct interpretation of HTML declarations concerning
webfonts are: "Andale Mono", "Arial", "Arial Black", "Comic Sans MS", "Courier
New", "Georgia", "Impact", "Times New Roman", "Trebuchet MS", "Verdana",
"Webdings"; "Arial Narrow", "Lucida Sans Unicode", "Symbol", "Tahoma",
"Wingdings". The filenames specified should match those in FONTS:
that end with with the "regular.font" specification (e.g.
arialregular.font). When you use Firefox preferences to set the basic font size for the default proportional font, actually Firefox will automatically set also the basic font size for all the other fonts, as well as the typographic sizes corresponding to the 7-step HTML scale for each of these fonts. So, inserting the values shown above even for all the other webfonts in the font preferences of your Amiga browser, you might obtain a good replica of absolute on-screen font sizes used by Firefox. A comparison shows that this is not yet perfect, however, because there are small variations of sizes concerning some fonts. Operating again by trial and error, one finds the typographic values that can be used for compensating these relative variations. In conclusion, all the relevant fonts and sizes for cloning Firefox webfont sizes are summarized in the tables below.
Clicking on the following thumbnails you will see the aspect of the webfont test file as it is displayed by Firefox on the PC/Windows platform, and by AWeb, IBrowse, and Voyager on the Pegasos/MorphOS platform after the cure described above.
Firefox Font FeaturesEven if the result of the previous subsection is a success, a couple of problems concerning webfont management still remain unsolved:
Items A and B have a common solution: enlarging or decreasing all font sizes at the same time. However, if this action is done without care, we have no guarantee that the new font sizes are still cloning the aspect of Firefox in the same conditions... This fact can be clarified by an example. Assume that the virtual user who ran Firefox in 1280x1024 resolution in the previous subsection, changes his mind and wants to switch to 800x600 resolution. Now the previous fonts are too large, but font size compensation is very easy with Firefox. The user goes into the font setting window and selects a new, more suitable, font size for the default proportional and monospace fonts, say 15. Then, starting from this value, Firefox generates on the fly new sets of typographic sizes for the seven HTML sizes of each webfont, and soon starts displaying HTML pages with more suitable fonts. An user of the Pegasos/MorphOS platform, who also run his system in 800x600 resolution, should start cloning this new set of font sizes by repeating again all the operations mentioned in the previous subsection. Since this takes much time, he could search for a magic formula able to calculate all the new font sizes that still clone the aspect of Firefox display. Actually this is possible: I have deduced this general formula, it is not difficult. What is really an obstacle is the fact that Amiga browsers have no automatic font management. Even if you know instantly all the sizes that should be assigned to the webfonts for perfect Firefox cloning, you must input them manually in the font configuration of your browser. And this is a long and boring procedure, because you must substitute more than one hundred values in the preference file [(2 default fonts + 3 trapping declarations + 11 webfonts) x 7 HTML sizes = 112 typographic sizes)]. The same problem is much more critical if you surf the web and reach a page where current fonts are so small or so big that you cannot read the HTML page in a convenient way. With Firefox you do not even need to go to the font preferences for a compensation: in fact, it is sufficient to press and hold the <CTRL> key and turn the mousewheel (or press a number of times the <+> or <-> keys). These actions enlarge/decrease on the fly all the fonts in a proportional way, until their sizes are optimized for your sight (<CTRL><0> resets all the sizes to their default values). On the Pegasos/MorphOS platform, instead, even if you know the values needed for the above-mentioned font size compensation, Amiga browsers do not offer solutions for on-the-fly correction. Item C needs the calculation of seven typographic sizes only, but still requires manual change of the preference files in Amiga browsers. Item D concerns, among the others, the definition of a lower threshold for font sizes. In other terms, if an user action (in the font preferences or by means of <CTRL><MOUSEWHEEL> or <CTRL><->) requires the display of fonts whose size is lower than the threshold value, then the threshold value is used for those sizes. This prevents the use of tiny fonts and increases the readability. This property is simply not available in Amiga browsers. In conclusion, all the items above are handled by Firefox on the PC/Windows platform by means of dynamic font management. In other terms, Firefox recalculates automatically and changes instantaneously all or part of the typographic sizes used for displaying the webfonts. Actually, the items above can be managed also by any browser running on the Pegasos/MorphOS platform. The real problem is that Amiga browsers have no native dynamic font management, so all the changes required should be inserted manually in the preferences. This is unpractical because long input times are necessary just when a real time reaction is needed. Well, I have written an ARexx program that, used as a browser plugin, manages dynamically the typographic sizes of all the webfonts. A complete description of this routine is provided in a following subsection. This plugin modifies absolute and relative sizes of webfonts, tunes up these sizes in such a way that Firefox displays are perfectly cloned, and also reproduces all the other font features of Firefox. These are the good news... ...The bad news are that my ARexx plugin works only with AWeb: unfortunately I cannot provide IBrowse and Voyager users neither with the automatic font setting mentioned in the previous subsection nor with dynamic font management. This lack of support is not due to my laziness or bad will, but it is only an effect of the choices done by the programmers of these browsers in the design phase. In fact the preference files of AWeb are simple ASCII text files. They can be easily read and edited, their structure can be studied and understood, and their manipulation with external ARexx management routines is an easy task. Instead, both IBrowse and Voyager preference files are in binary format, which makes extremely difficult to change on the fly their contents. They cannot be edited, they must be zapped or modified with a hexadecimal editor, provided you know exactly what you are doing. This fact, in turn, either requires the ability of a hacker/pirate, or the good will of the author (who must make public the format of the preference file) and a programmer (who should write a management routine much more complex than my ARexx programs). So, if you have complaints, please send them to the authors of IBrowse and Voyager, or find a programmer/hacker more expert than me. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||