missing NULL terminator in set_config_x
[geda-gaf.git] / docs / wiki / geda-pcb_fonts.html
blob37e859777f3cff384604626739c51627bc6841ff
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html>
4 <head>
5 <link rel="stylesheet" media="screen" type="text/css" href="./style.css" />
6 <link rel="stylesheet" media="screen" type="text/css" href="./design.css" />
7 <link rel="stylesheet" media="print" type="text/css" href="./print.css" />
9 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
10 </head>
11 <body>
13 <h1 class="sectionedit1" id="fonts">Fonts</h1>
14 <div class="level1">
16 <p>
17 A font system has been implemented in the git branch home/cparker/font_fun. This system was initially designed by Chad Parker. The initial set of fonts were converted for PCB by Erich Heinzle. With this system, the font of a design can be easily changed, and multiple fonts can be used in the same design. This system also reduces the need to store font data in saved design files, because a font name should be forever. If a font ever changes, it should be given a new name. So, saved designs can reference only the font name without having to worry about the font changing and a design being different when it is next opened.
18 </p>
20 <p>
21 <a href="media/geda/pcbwithmultifonts.png" class="media" target="_blank" title="geda:pcbwithmultifonts.png"><img src="media/geda/pcbwithmultifonts.png" class="media" alt="" width="600" /></a>
22 </p>
24 </div>
25 <!-- EDIT1 SECTION "Fonts" [1-678] -->
26 <h1 class="sectionedit2" id="usage">Usage</h1>
27 <div class="level1">
29 </div>
30 <!-- EDIT2 SECTION "Usage" [679-696] -->
31 <h2 class="sectionedit3" id="getting_the_feature_branch">Getting the Feature Branch</h2>
32 <div class="level2">
34 <p>
35 To test the font system, check out the feature branch from git. Switch to the feature branch with
36 </p>
37 <pre class="code">git checkout home/cparker/font_fun</pre>
39 <p>
40 reconfigure if necessary and build. Then, run pcb by executing the pcbtest.sh script in the src directory. This is important because it sets the font path so that pcb can load some of the included fonts.
41 </p>
43 </div>
44 <!-- EDIT3 SECTION "Getting the Feature Branch" [697-1086] -->
45 <h2 class="sectionedit4" id="font_settings">Font Settings</h2>
46 <div class="level2">
48 <p>
49 All font settings can be viewed and edited from the Fonts tab in the preferences window.
50 </p>
52 <p>
53 <a href="media/geda/fontprefswindow.png" class="media" target="_blank" title="geda:fontprefswindow.png"><img src="media/geda/fontprefswindow.png" class="media" alt="" width="600" /></a>
54 </p>
56 <p>
57 There are three font related options that can be configured:
58 </p>
59 <ul>
60 <li class="level1"><div class="li"> <strong>“Save font data in files”</strong><br/>
61 When enabled, this will save the font of text objects in saved design files. If disabled, it will not, and the design will be backwards compatible with older versions of pcb.</div>
62 </li>
63 <li class="level1"><div class="li"> <strong>“Save current system font as symbols in pcb files (old format).”</strong><br/>
64 This option is only available when “Save font data in files” is disabled. This option does exactly what it says. This is how you can save a font in a design file that is compatible with older versions of pcb.</div>
65 </li>
66 <li class="level1"><div class="li"> <strong>“Embed used fonts in pcb files”</strong><br/>
67 This option is only available when “Save font data in files” is enabled. This option will store the font information of every font used in the design into the saved pcb file. This makes the pcb file portable to other systems that may not have the same fonts installed, or a different version of a font installed.</div>
68 </li>
69 </ul>
71 <p>
72 There are two fonts that can be configured:
73 </p>
74 <ul>
75 <li class="level1"><div class="li"> <strong>System font</strong>:<br/>
76 The system font is used for all new objects that are added to the design, and also for system generated text such as pin numbers and pin functions. System font information is not stored in saved designs.</div>
77 </li>
78 <li class="level1"><div class="li"> <strong>PCB font</strong>:<br/>
79 The PCB font is stored in saved files as the default font for a design. It is used for any texts that cannot be assigned a font, presently reference designators. It&#039;s also the font that is assigned to any texts that don&#039;t have a specific font assigned when the design is loaded. The system font is set to this after loading.</div>
80 </li>
81 </ul>
82 <div class="noteclassic">If a design is loaded and requests a font that is not on the system, it will issue a warning to the message log and the text will be displayed using the system font. If the system font is changed, it will also change. (This behavior should be reviewed.)
83 </div>
84 <p>
85 The fonts can also be manipulated by executing <a href="geda-pcb_fonts.html#actions" class="wikilink1" title="geda-pcb_fonts.html">Actions</a>.
86 </p>
88 </div>
89 <!-- EDIT4 SECTION "Font Settings" [1087-3117] -->
90 <h2 class="sectionedit5" id="font_libraries">Font Libraries</h2>
91 <div class="level2">
93 <p>
94 There are two font libraries:
95 </p>
96 <ul>
97 <li class="level1"><div class="li"> <strong>System Font Library:</strong><br/>
98 This library contains all of the fonts that pcb knows about that are stored on the local system. Fonts can be loaded and unloaded from this library using actions. This functionality is not yet available in the preferences menu, but it is planned to be eventually.</div>
99 </li>
100 <li class="level1"><div class="li"> <strong>Embedded Font Library:</strong><br/>
101 This library contains the fonts that are stored in the pcb file of the current design. The only control a user has over this library is in the fonts that he or she chooses to use in the design. This library is populated whenever a pcb file is loaded. If you load a file, add an object with a different font, and choose to save the file with fonts embedded, the additional fonts will be saved in the file, but the embedded library will only be updated if you reload the pcb file. A possible future extension might be to allow the user to explicitly move fonts into the embedded library.</div>
102 </li>
103 </ul>
105 </div>
106 <!-- EDIT5 SECTION "Font Libraries" [3118-4087] -->
107 <h2 class="sectionedit6" id="changing_fonts">Changing Fonts</h2>
108 <div class="level2">
111 Fonts can be easily changed using the Fonts tab in the preferences window:
112 </p>
113 <ul>
114 <li class="level1"><div class="li"> Open the Preferences window and switch to the Fonts tab.</div>
115 </li>
116 <li class="level1"><div class="li"> Select the new font to be assigned to the text objects. </div>
117 </li>
118 <li class="level1"><div class="li"> In the main window, select the text objects to which the font should be assigned.</div>
119 </li>
120 <li class="level1"><div class="li"> Click the “Change Selected” button to assign the new font to the text objects.</div>
121 </li>
122 </ul>
125 Alternatively, all text in a design can have a font assigned by using the “Change All” button.
126 </p>
129 Note that these methods will only change the font of discrete text objects. Reference designators of components cannot presently have fonts assigned to them individually. However, the font of *all* reference designators can be changed together by setting the PCB Font to the desired font.
130 </p>
132 </div>
133 <!-- EDIT6 SECTION "Changing Fonts" [4088-4865] -->
134 <h2 class="sectionedit7" id="compatibility_with_older_versions_of_pcb">Compatibility with Older Versions of PCB</h2>
135 <div class="level2">
138 Previous versions of pcb would store the data of a single font in saved files as symbols. Alternatively, if the file did not contain symbols, perhaps because they were deleted, then pcb would load the default font instead. This feature branch will still play nicely with these scenarios.
139 </p>
142 If you load an existing design that has symbols stored in the design, the symbols will be converted into an embedded font (Font 0), all the text objects in the design will use that font, and that font will be set as the system font. If the design does <em>not</em> have symbols stored in it, then the text objects will be assigned the <em class="u">system font</em>. So, if you&#039;ve changed the system font then the text objects will not look exactly as they did when you saved them. However, If you load a design and don&#039;t like the font the text ends up in, it&#039;s easy to change the font.
143 </p>
145 </div>
146 <!-- EDIT7 SECTION "Compatibility with Older Versions of PCB" [4866-5774] -->
147 <h1 class="sectionedit8" id="implementation">Implementation</h1>
148 <div class="level1">
151 The font system is implemented using a few data structures and several actions.
152 </p>
154 </div>
155 <!-- EDIT8 SECTION "Implementation" [5775-5882] -->
156 <h2 class="sectionedit9" id="data_structures">Data Structures</h2>
157 <div class="level2">
159 </div>
160 <!-- EDIT9 SECTION "Data Structures" [5883-5908] -->
161 <h3 class="sectionedit10" id="font_type">Font Type</h3>
162 <div class="level3">
165 The font data structure is called FontType and is defined in global.h as follows:
166 </p>
167 <pre class="code c"><span class="kw4">typedef</span> <span class="kw4">struct</span>
168 <span class="br0">&#123;</span>
169 <span class="kw4">char</span> <span class="sy0">*</span> Name<span class="sy0">;</span>
170 <span class="kw4">char</span> <span class="sy0">*</span> SourceFile<span class="sy0">;</span>
171 Coord MaxHeight<span class="sy0">;</span> <span class="coMULTI">/*!&lt; Maximum cell width. */</span>
172 Coord MaxWidth<span class="sy0">;</span> <span class="coMULTI">/*!&lt; Maximum cell height. */</span>
173 BoxType DefaultSymbol<span class="sy0">;</span> <span class="coMULTI">/*!&lt; The default symbol is a filled box. */</span>
174 SymbolType Symbol<span class="br0">&#91;</span>MAX_FONTPOSITION <span class="sy0">+</span> <span class="nu0">1</span><span class="br0">&#93;</span><span class="sy0">;</span>
175 <span class="kw4">int</span> nSymbols<span class="sy0">;</span>
176 <span class="br0">&#125;</span> FontType<span class="sy0">;</span></pre>
179 The MaxHeight and MaxWidth parameters are set by the SetFontInfo function that&#039;s been relocated into font.c. This structure has updated to include two new fields for the name of the font and the source file of the font.
180 </p>
182 </div>
183 <!-- EDIT10 SECTION "Font Type" [5909-6547] -->
184 <h3 class="sectionedit11" id="font_libraries1">Font Libraries</h3>
185 <div class="level3">
188 The two font libraries (system and embedded) are both implemented as GLib GSLists. Each list element points to a FontType structure. The choice of a GSList was made because its a simple structure, and at the moment I don&#039;t anticipate there being a vast database of fonts to choose from, so searching through a list ought not to take all that long. GLib includes many functions for working with GSLists, and these are used for managing and accessing the list items.
189 </p>
191 </div>
193 <h4 id="finding_fonts">Finding Fonts</h4>
194 <div class="level4">
197 Searching through the library for a font is done by using the FindFontInLibrary function. This function iterates through the list once comparing the name of the font to the provided reference string. If a match is not found, the list is searched through again comparing the name of the source file. If it&#039;s still not found then a null is returned.
198 </p>
201 A second function, FindFont, is available for searching. This function searches first through the embedded library, and if the font is not found, it will then search through the system library. This way, the embedded library always has precedence. So, if a customized version of a font is stored in the pcb file and there is a system font with the same name, the embedded font will be used. The assumption is that if the font was explicitly stored in the file, it was done so to ensure that it was used.
202 </p>
204 </div>
205 <!-- EDIT11 SECTION "Font Libraries" [6548-7909] -->
206 <h3 class="sectionedit12" id="font_file_format">Font File Format</h3>
207 <div class="level3">
210 The format for font files is basically the same as the format for symbols in complete pcb files, with one new keyword: Font. The argument of the Font keyword is the name of the font. Following the Font keyword a set of symbols using the existing pcb format are wrapped inside of normal parenthesis.
211 </p>
212 <pre class="code">Font(&quot;Default&quot;) (
213 Symbol(&#039; &#039; 18)
216 Symbol(&#039;!&#039; 12)
218 SymbolLine(0 35 0 40 8)
219 SymbolLine(0 0 0 25 8)
222 ) # end font</pre>
225 The “# end font” is just for reference and is not required.
226 </p>
229 A font file can have one or more fonts defined in succession.
230 </p>
232 </div>
233 <!-- EDIT12 SECTION "Font File Format" [7910-8494] -->
234 <h3 class="sectionedit13" id="pcb_file_format_changes">PCB File Format Changes</h3>
235 <div class="level3">
237 </div>
239 <h4 id="embedded_font_syntax">Embedded Font Syntax</h4>
240 <div class="level4">
243 A single addition to the file format has been implemented. That&#039;s the Font directive that was described above. That directive can have two meanings. Fonts can be embedded in regular pcb files using the same syntax as above. The only caveat is that the font must be defined early in the file, between the styles and the layout data.
244 </p>
247 The Font directive can also be included without symbols. If it appears this way, then the argument is considered to be the PCB Default Font. This font is made the current font and is used for all reference designators and for any text objects that are not explicitly assigned a font.
248 </p>
250 </div>
252 <h4 id="text_syntax">Text Syntax</h4>
253 <div class="level4">
256 There is also an addition to the text syntax. It&#039;s labeled in <code>parse_y.y</code> as <code>text_20161008_format</code>. This is the same as <code>text_hi_format</code> with the addition of a second string field. The second string field is interpreted as the font. Here&#039;s the syntax definition:
257 </p>
258 <pre class="code">text_20161008_format
259 /* x, y, direction, scale, text, font, flags */
260 : T_TEXT &#039;[&#039; measure measure number number STRING STRING flags &#039;]&#039;
262 FontType * font = FindFont($8);
263 if(!font) Message(_(&quot;Warning: Could not find font %s for text \&quot;%s\&quot;\n&quot;), $8, $7);
264 CreateNewText(Layer, font, NU ($3), NU ($4), $5, $6, $7, $9);
265 free ($7);
266 free ($8);
269 </pre>
271 </div>
272 <!-- EDIT13 SECTION "PCB File Format Changes" [8495-9881] -->
273 <h2 class="sectionedit14" id="actions">Actions</h2>
274 <div class="level2">
276 </div>
277 <!-- EDIT14 SECTION "Actions" [9882-9899] -->
278 <h3 class="sectionedit15" id="change_font">Change Font</h3>
279 <div class="level3">
282 The ChangeFont action can has two forms that can be invoked from the pcb command entry, a single argument version and a two argument version.<br/>
284 Syntax:<br/>
286 </p>
287 <ul>
288 <li class="level1"><div class="li"><code>ChangeFont(fontname)</code><br/>
289 With one argument, the <code>ChangeFont</code> action changes the current system font to the font specified by <code>fontname</code>.<br/>
290 </div>
291 </li>
292 <li class="level1"><div class="li"><code>ChangeFont([All|Selected|Object|System|PCB], fontname)</code><br/>
293 With two arguments, the <code>ChangeFont</code> action changes the font of the specified item to the font specified by <code>fontname</code>.<br/>
294 </div>
295 </li>
296 </ul>
299 The first argument to the second form has the following effects:
300 </p>
301 <ul>
302 <li class="level1"><div class="li"> <code>All</code><br/>
303 Change the font of *all* existing text objects to the specified font. </div>
304 </li>
305 <li class="level1"><div class="li"> <code>Selected</code><br/>
306 Change the font of all *selected* text objects to the specified font.</div>
307 </li>
308 <li class="level1"><div class="li"> <code>Object</code><br/>
309 Change the font of the object underneath the crosshair.</div>
310 </li>
311 <li class="level1"><div class="li"> <code>System</code><br/>
312 Change the system font. This has the same function as the single argument invocation.</div>
313 </li>
314 <li class="level1"><div class="li"> <code>PCB</code><br/>
315 Change the PCB font.</div>
316 </li>
317 </ul>
318 <div class="noteclassic">The <code>All</code>, <code>Selected</code>, and <code>Object</code> action will not change the font of dynamically generated text such as pin names/numbers or text that cannot be assigned a specific font, such as reference designators.
320 </div><div class="noteclassic">Changing the System or PCB font will update all of the dynamically generated text or reference designators, respectively.
322 </div>
323 </div>
324 <!-- EDIT15 SECTION "Change Font" [9900-11225] -->
325 <h3 class="sectionedit16" id="load_font">Load Font</h3>
326 <div class="level3">
329 The Load Font Action attempts to load a font from a font file.<br/>
331 Syntax:
332 </p>
333 <ul>
334 <li class="level1"><div class="li"> <code>LoadFont(&lt;filename&gt;)</code><br/>
335 Load a font from the specified file.</div>
336 </li>
337 <li class="level1"><div class="li"> <code>LoadFont(All)</code><br/>
338 Scan the font path(s) and attempt to load fonts from any file with the extension <code>.pcb_font</code>.</div>
339 </li>
340 </ul>
343 The Load Font Action is primarily an interface to the LoadFont function which takes as an argument being the name of the file containing the font(s) to load.
344 </p>
347 Fonts can only be deliberately loaded to the system font library, so prior to reading the specified file, the system library is checked for a font that came from a file with the same name. If it is present, then it does not reload the font. So, if you&#039;ve changed a font and want to update it without closing pcb, you must first use the Unload Font Action to unload the font. Then you can reload it. (Note that the Unload Font Action will not allow you to unload a font that is currently being used in the design.)
348 </p>
351 A note on the LoadFont function: the ParseFont function is still used, however, the details of how fonts are parsed in parse_y.y have been modified to create fonts in the appropriate library. After ParseFont reads the file and loads the data, the new font is appended to the end of the GSList that is the library. LoadFont exploits this to get the font pointer and set the name of the source file in the data structure. LoadFont then explicitly sorts the library to put the entry in alphabetical order.
352 </p>
354 </div>
355 <!-- EDIT16 SECTION "Load Font" [11226-12683] -->
356 <h3 class="sectionedit17" id="unload_font">Unload Font</h3>
357 <div class="level3">
360 The Unload Font Action is used for removing a font from the system library.<br/>
362 Syntax:<br/>
364 </p>
365 <ul>
366 <li class="level1"><div class="li"> <code>UnloadFont(&lt;fontname&gt;)</code><br/>
367 Unload the font with the specified name.</div>
368 </li>
369 <li class="level1"><div class="li"> <code>UnloadFont(&lt;filename&gt;)</code><br/>
370 Unload the font loaded from the specified file name.</div>
371 </li>
372 </ul>
375 The Unload Font Action acts primarily as an interface to the UnloadFont function. This action first checks to see if the specified font is in the system library, and then checks to see if that font is used anywhere in the design.
376 </p>
377 <div class="noteclassic">The Unload Font Action will not allow a font that is used in the current design to be unloaded from the font library.
378 </div>
380 The Unload Font Action will also not allow the Default font to be unloaded, and although it should be redundant, checks to ensure that there is always at least one font in the system library.
381 </p>
384 A note about the UnloadFont function. All of the sanity checking is performed in the Action, not in the function, because there are things that the system should be able to do that the user shouldn&#039;t. For example, the UnloadFont function is capable of unloading fonts from either the system library or the embedded library. This is to facilitate the closing of designs and the of the program. UnloadFont can be called with the font name “<code>all</code>” which will enter a loop that will unload every font in the library.
385 </p>
387 </div>
388 <!-- EDIT17 SECTION "Unload Font" [12684-14023] -->
389 <h3 class="sectionedit18" id="list_fonts">List Fonts</h3>
390 <div class="level3">
393 The List Fonts Action was primarily for use as an introspection tool to evaluate the font system during development, however it may also find use facilitating testing. This action takes no arguments and writes to the message log the names of all of the fonts in the system library and the embedded library, the currently system font, the PCB font, and all of the fonts presently in use. <br/>
395 Syntax:<br/>
397 </p>
398 <ul>
399 <li class="level1"><div class="li"> <code>ListFonts()</code><br/>
400 List all fonts in use in the current design.</div>
401 </li>
402 </ul>
405 A noteworthy function that is used here is the FontsUsed() function. This function builds a GSList of all the fonts used in the design. The list must be freed by the calling function.
406 </p>
409 Possible future upgrades/expansions for this or a similar function:
410 </p>
411 <ul>
412 <li class="level1"><div class="li"> list information about which library a font is in</div>
413 </li>
414 <li class="level1"><div class="li"> take as an argument the name of a font and list the text objects that use that font</div>
415 </li>
416 </ul>
418 </div>
419 <!-- EDIT18 SECTION "List Fonts" [14024-14905] -->
420 <h2 class="sectionedit19" id="processes">Processes</h2>
421 <div class="level2">
423 </div>
424 <!-- EDIT19 SECTION "Processes" [14906-14925] -->
425 <h3 class="sectionedit20" id="startup_shutdown">Startup/Shutdown</h3>
426 <div class="level3">
429 When PCB starts up the font system has several command line options that are processed like normal options. These options include:
430 </p>
431 <ul>
432 <li class="level1"><div class="li"> <code>font-path</code><br/>
433 The path(s) in which to search for font files</div>
434 </li>
435 <li class="level1"><div class="li"> <code>font-file</code><br/>
436 The file name of the “Default” font. This is loaded first to ensure that there is always at least one font in the system.</div>
437 </li>
438 <li class="level1"><div class="li"> <code>save-font-data</code><br/>
439 Save font information in pcb files. This is required in order for fonts to persist across saves. It will save the name of the font with the text object in the file. This option does not cause the fonts themselves to be included in the file (the <code>embed-font</code> option has that effect). Disabling this option will make the saved files backwards compatible with older versions of pcb.</div>
440 </li>
441 <li class="level1"><div class="li"> <code>save-symbols</code><br/>
442 This option causes the symbols of the current system font to be stored in saved files. This is the way that pcb has previously preserved a potentially modified font across saves. </div>
443 </li>
444 <li class="level1"><div class="li"> <code>embed-fonts</code><br/>
445 This option will embed the data for every font used in the design in the saved files. This ensures portability across systems that may have different fonts or different versions of the same font installed.</div>
446 </li>
447 </ul>
450 The font system is initialized in the <code>settings_post_process</code> function (<code>main.c</code>). Here, the <code>font-file</code> is searched for in the <code>font-path</code>(s) and loaded. Then the <code>font-path</code>(s) are searched by the <code>ScanFontPaths</code> function (<code>font.c</code>) for any files that have a <code>.pcb_font</code> extension, and these files are read looking for font information.
451 </p>
453 </div>
454 <!-- EDIT20 SECTION "Startup/Shutdown" [14926-16483] -->
455 <h3 class="sectionedit21" id="file_load">File Load</h3>
456 <div class="level3">
459 The loading of a pcb file has two parts: 1. the actual reading of data from the file and converting it into pcb data structures, and 2. applying policy to the loaded data. (1) is implemented using bison/flex in <code>parse_y.y</code> and <code>parse_l.l</code>. (2) is implemented in <code>file.c</code> in the <code>real_load_pcb</code> function.
460 </p>
462 </div>
464 <h4 id="reading_data_from_files_into_data_structures">Reading Data From Files Into Data Structures</h4>
465 <div class="level4">
467 </div>
469 <h5 id="font_data">Font Data</h5>
470 <div class="level5">
473 Font data is required to be located after style data and before object data in the pcb file (this is a requirement from before the font system that results from the definition of the file grammar). The variable <code>yyFont</code> acts as the global pointer to the current font. When font data (an embedded font or floating symbols) is found a new font instance is created in the appropriate library (depending on whether <code>yyPCB</code> is NULL, if not we&#039;re loading a pcb file, otherwise we&#039;re loading a font file), and subsequent symbols are added to that. If a new font is found, a new font instance is created and yyFont is updated to point at the new font. If only the font directive is found (no symbols), then the <code>DefaultFontName</code> field of the PCBType structure is updated with the name. (I&#039;ve been inconsistent in the docs about referring to this font name as both the <code>PCBDefaultFont</code> and the <code>DefaultPCBFont</code>)
474 </p>
476 </div>
478 <h5 id="text_data">Text Data</h5>
479 <div class="level5">
482 When text data is read from the file, it will either use the standard format, in which case the font pointer is initially set to NULL, or it will have a font specified, in which case the specified font is searched for in the font library (embedded library first). If the font is not found, then the font pointer is set to NULL. In post processing, any text object that has a NULL font pointer is set to the <code>DefaultPCBFont</code>. If the <code>DefaultPCBFont</code> is NULL, then the font pointers remain set to NULL. This could happen if this is a pcb file from an older version that has no font information. When the font pointer of a text object is NULL, it is displayed using the system font instead. So, it&#039;s possible to completely ignore the font system, change the system font, and in doing so change the font of every bit of text on the board (including refdes).
483 </p>
485 </div>
487 <h5 id="element_data">Element Data</h5>
488 <div class="level5">
491 The format of element data in pcb files doesn&#039;t presently include font information, so individual font cannot be stored for individual ref des. New elements are created via the <code>CreateNewElement</code> function (<code>create.c</code>) which adds text to the element via the <code>AddTextToElement</code> function (<code>create.c</code>). This function searches for the <code>PCBDefaultFont</code>, and assigns that if it&#039;s found, or NULL otherwise.
492 </p>
494 </div>
496 <h4 id="post_loading_policy">Post Loading Policy</h4>
497 <div class="level4">
500 The policy defines how to handle objects that need fonts but were not assigned one during load. This is the magic that will hopefully make pcb “do the right thing” when loading older versions of pcb files.
501 </p>
503 </div>
505 <h5 id="system_font_and_default_font_name">System Font and Default Font Name</h5>
506 <div class="level5">
509 The first (font related) thing pcb tries to do after loading all the data from a pcb file is figure out if it needs to change the current system font. If a <code>DefaultFontName</code> was specified, the system font is changed to this font. If we&#039;re dealing with an older file, there will be no <code>DefaultFontName</code> specified, but there still might be font data in the file (as loose symbols), and if there is, then it should be used. Symbol data gets loaded as a font in the embedded library, so if there are any fonts in the embedded library, the first one is set to be the system font. (Is this behavior okay if there are embedded fonts but no default font?)
510 </p>
512 </div>
514 <h5 id="text_data1">Text Data</h5>
515 <div class="level5">
518 After loading all data,
519 </p>
521 </div>
522 <!-- EDIT21 SECTION "File Load" [16484-20056] -->
523 <h3 class="sectionedit22" id="file_save">File Save</h3>
524 <div class="level3">
526 </div>
527 <!-- EDIT22 SECTION "File Save" [20057-20074] -->
528 <h2 class="sectionedit23" id="to_do_list">To Do List</h2>
529 <div class="level2">
532 These are tasks and ideas related to the font subsystem that still need to be done, could be done, or are in progress:
533 </p>
534 <ul>
535 <li class="level1"><div class="li"> Move work done in ChangeFontAction to separate function to isolate the work from the undo serial number increment</div>
536 </li>
537 <li class="level1"><div class="li"> Check what happens when loading a font file if a <code>DefaultFontName</code> is specified</div>
538 </li>
539 <li class="level1"><div class="li"> Add licensing info to font files</div>
540 </li>
541 <li class="level1"><div class="li"> Add fonts to install (and figure out where they should go)</div>
542 </li>
543 <li class="level1"><div class="li"> Write test scripts</div>
544 </li>
545 <li class="level1"><div class="li"> Add documentation to doc/ tree</div>
546 </li>
547 <li class="level1"><div class="li"> Add flow diagrams to code comments</div>
548 </li>
549 <li class="level1"><div class="li"> Font preview in settings window</div>
550 </li>
551 <li class="level1"><div class="li"> Character map for selecting non standard characters</div>
552 </li>
553 <li class="level1"><div class="li"> User control of fonts in embedded library</div>
554 </li>
555 <li class="level1"><div class="li"> Save font(s) to a file</div>
556 </li>
557 <li class="level1"><div class="li"> “Font mode” saving of fonts to font files.</div>
558 </li>
559 </ul>
561 </div>
562 <!-- EDIT23 SECTION "To Do List" [20075-] --></body>
563 </html>