|
8 Configuration8.1 FontsThe fonts that Tonto2 uses may or may not be installed by (or with) Tonto2. I reckon that those fonts I distribute along with Tonto2, if any, are free of any restrictions on their use by me or by you. If you intend to use the UPCA, EAN13, Code39, Code39X, or Code128 flds, which show as bar codes when viewed as text, you'll want to be sure the corresponding fonts are installed. (UPCA is handled by the EAN13 font.) If not, don't worry about it because this may be easier said than done. You may be able to obtain the fonts you need on your own even though I am squeamish about distributing them. Tonto2's barcodes2.py module has four hard-coded font names: Libre Barcode EAN13 Text Libre Barcode 39 Text Libre Barcode 39 Extended Text Libre Barcode 128 Text These are available for download from Google Fonts. The barcodes2.py module renders the text of bar-code flds as a string of glyphs that are likely to make sense visually only when formatted with the correct font. Now, why would it be significant to show bar codes as bar codes? Gee, I don't know, but it might go something like this. You are building a Christmas shopping list, and relatives are attaching snapshots to their tweets (Can we still call them that?) about items they want, so you start Googling to find various retail outlets that handle these items. To be certain that you've identified the products correctly, you add a UPCA field to your Want List rel in Tonto2, sort the tab, and whittle down the duplicates to one or two reasonably priced sources for each unique item, keeping track of how many of each you are going to need. You visit the recs for each item, view the rec as text, preview it in your browser, and print a page for each rec. The page has the bar code on it that you can haul around from store to store. You wait to open the merchant's cell-phone app until you arrive. That way you know the app knows which store you're in from your GPS location. Well, maybe.... And, using your cellphone camera, you can scan the bar code from the page into the merchant's app to find the shelf location. It's easy-peasy and very nearly worth the trouble ... when it works ... if you can identify the products. The trick is to use Tonto2 to view the rec as text and then preview it in your browser. And, naturally, there are some gotchas in situations due to a combination of your browser and the fonts you are trying to display. For one thing, you may be using a super-secure browser — such as the Tor Browser, which is hardened against hacker exploits directed against your computer by remote Bad Actors. It bounces all your traffic through a distributed network of computers worldwide to conceal your sources from your own Internet Service Provider (ISP), to anonymize you at the Web servers you visit, and to frustrate tracking by these and any middlemen. It tries very hard to avoid fingerprinting you. (See Wikipedia, "Device Fingerprint.") One of the things that can reduce you from one in millions of Internet users to one in dozens is your set of installed fonts, which are detectable to a degree by any Web server. Thus, to avoid revealing your fonts, the Tor Browser substitutes its own. Any attempt to display barcodes is doomed (particularly at the higher security levels that you typically would invoke with the Tor Browser). ... so there's that. Even users of more or less standard browsers with more or less lax security settings may not escape unscathed. Weirdly, the Code39 and Code128 fonts are considered symbol fonts. Browsers — such as Firefox — won't render them because developers — such as Mozilla — believe (however pigheadedly) that symbols should be Unicode encoded instead of depending on specialized fonts. They insist on this to be able consistently to display all kinds of Web pages foreign and domestic, and who can blame them?Thus, Firefox may display UPCA and EAN13 because these are not symbol fonts — apparently — but will not show Code39, Code39X, and Code128 because these are. The Tor Browser will not display any locally installed fonts including barcodes. WorkaroundsIt's not all that hard to display barcodes if you have the correct fonts installed. Tonto2 will do this when the rec is displayed as text. You should be able to scan a barcode from Tonto2's window with your cellphone camera. If all you want to do is to see it or scan it, display as text should be good enough, but, if you want to do more — such as print it out, the process is a little more fraught. Tonto2 does not talk to printers, so, if you want to print a barcode, you're going to have to preview it in your browser and print it from there. But what if your browser won't cooperate? You could try saving the page from your browser and opening it in your word-processing app. Many word-processing apps — such as LibreOffice — will read and render *.html files in all their font-astic glory. You could use your word-processing app to print the document. Maybe you can take a screenshot of Tonto2's window. You could bring up the image file in a photo-editing app — such as gimp — and print from there, or you could open the image file in your browser and print from there. It isn't for the faint of heart, and it's a little beyond the (admittedly narrow) scope of Tonto2, but, from time to time, you may wish to serve a Web page to all comers that contains barcodes. How would you do that? You could edit your screenshot of Tonto2's window to crop and save the barcode as an image file and include that in your Web page. Your readers don't need to understand barcode fonts; they can still see images of them. You could find out how Tonto2 asks your browser to render the barcode by examining the preview page source and steal the actual encoded barcode string from there. Then you might be able to use offline image-generation apps that work with formatted text — such as gimp , imagemagick , netpbm's pbmtext (Henderson), or Pillow scripting (Clark) — to generate an image from scratch. This would be more worthwhile the more barcodes you have to do. You could steal a larger snippet of the preview page source containing the context surrounding the encoded barcode string to include as *.html code in your own Web page. This has the unfortunate disadvantage of exposing your readers to font dependencies, but wait! All is not lost. Try including this code in your Web page: <head> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Libre+Barcode+EAN13+Text" > <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Libre+Barcode+39+Text" > <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Libre+Barcode+39+Extended+Text" > <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Libre+Barcode+128+Text" > </head> You may find that this by itself enables barcodes of all kinds in the Tor Browser and in Firefox without resort to any locally installed fonts. There is yet more to say about fonts, but I reserve it for the *.ini file discussion, below. 8.2 Standard Freedesktop DirectoriesTonto2 configuration files are stored under standard path names (Bastian).
The tonto2.code_tables.ini file is installed with Tonto2. The tonto2.ini file is created the first time Tonto2 quits. 8.3 tonto2.code_tables.iniYou can use a text-file editor to modify the tonto2.code_tables.ini file as needed to add different code tables including language translations. The tonto2.code_tables.ini file should be modified only while Tonto2 is not running. For some fld types, coded values are stored in the csv files. When these flds are displayed, a coded meaning is shown instead. There are tables of commonly-used codes and their meanings in the tonto2.code_tables.ini file that are named for the context in which the meanings are used. Here is an example: [EVENT_STATUS] Active = Active Inactive = Inactive Pending = Pending Finished = Finished Closed = Closed In this case the table is a not-very-magical map of terms back onto themselves. It may be used in a Selection fld gently to suggest to the user commonly-used terms that he should hew to, or it may be used in a Code Table fld to enforce the use of one of those terms and no others. YES_NO_MAYBE is a more typical code table of the meaning of boolean yay/nay terms: [YES_NO_MAYBE] Y = Yes N = No X = Don't Know The code Y, N, or perhaps X (or #N/A) is actually stored in the csv file and not the wordier meaning ... to save space I guess. The tonto2.code_tables.ini file has a code table for state abbreviations for Canada, Australia, and the United States, but that is about the only table of general interest maintained at this writing. 8.4 tonto2.iniYou can use a text-file editor to modify the tonto2.ini file as needed to enhance some capabilities of Tonto2 in your environment. Here is what the tonto2.ini file looks like when you quit Tonto2 for the first time: [GLOBAL] geometry = state = ledger_font = noto sans semicondensed icon_file = /usr/share/icons/Adwaita/256x256/legacy/dialog-information.png alert_wav = #N/A festival_type_voice_synth = #N/A qr_code_generator = #N/A browser = most common current_tab_visual = week_first_day = 7 The tonto2.ini file should be modified only while Tonto2 is not running because, when Tonto2 does quit, any changes will be overwritten. Here is a description of these configuration settings. 8.4.1 Ini: geometryGeometry is set automatically by Tonto2. It uses this value to reestablish the position of its window when it is started. Don't try to change this manually. 8.4.2 Ini: stateState is set automatically by Tonto2. It uses this value to reestablish its open tabs when it is started. Don't try to change this manually, either. 8.4.3 Ini: ledger_fontTonto2 mostly relies on Qt to select its own fonts. Normally, Qt follows the font selections made by the prevailing theme of your windows manager. This may be Microsoft Windows, or not. On Windows, you can change the size of text.
On my Debian Linux system I use Gnome for my windows manager, and in the Adwaita theme the choice of fonts is not the best for Tonto2's tabular data presentation. Ledger_font Tonto2 configuration option lets you specify a font name for basic tabular data. I like noto sans semicondensed. It has the advantage of tabular figures. Wikipedia has a description of "tabular figures" in its "Monospaced Font" entry. You can download the noto sans family of fonts (8GB) from Google. For Linux users, it is available in the fonts-noto-core Debian package. If ledger_font is not available, Qt will pick the next best thing. 8.4.4 Ini: icon_fileAs of this writing, Tonto2 does not have a unique icon by which it is represented in the task bar, so you can specify one if you like. 8.4.5 Ini: alert_wavYou can specify an AlarmSound *.wav file for each Calendar event. You also can specify a default file here. I like /usr/share/sounds/sound-icons/xylofon.wav. Linux users may install the sound-icons Debian Linux package to get it. alert_wav = /usr/share/sounds/sound-icons/xylofon.wav 8.4.6 Ini: festival_type_voice_synthTonto2 can speak aloud the Title of an event while sounding the event's alarm if you have a voice-synthesizer utility installed. Linux users may install the festival package and specify: festival_type_voice_synth = festival --tts Windows users may install the eSpeak package and specify: festival_type_voice_synth = %%ProgramFiles(x86)%%\eSpeak\command_line\espeak.exe *.ini-file syntax requires the double percent signs (%%). eSpeak may be downloaded from SourceForge (jonsd). 8.4.7 Ini: qr_code_generatorQR Code flds are displayed as an image if you configure a qr_code_generator to create such an image. Linux users may install qrencode, which is a Debian package, and specify: qr_code_generator = qrencode --output {} Windows or Linux users may install segno, which is a pip package, and specify:
qr_code_generator = segno -o={} 8.4.8 Ini: browserPart of the magic of Tonto2 is that it is able to open links and Preview recs as text in your browser. Which browser do you want to use? Which browser will Tonto2 use? Tonto2's browser setting defaults to "most common." It simply runs down a list of well-known browsers for your operating-system environment, trying each in turn until it finds the first one that works. If this is not the one you want Tonto2 to use, you can specify a different one. Please restart Tonto2 and try Preview from View as Text to be sure your choice is a good one. You ought to know that Linux users are familiar with using korrect kapitalization in their browser names. In a Gnome Linux environment you can start the default browser under a dummy name, gnome-www-browser, so this works: browser = gnome-www-browser Alternatively, you can choose from the following browser names, but I am sure you can guess it is futile to try those that are not installed on your system. In the past, I provided a much shorter list, but, now, I reproduce all those mentioned in the Python docs.
Be aware that this list changes with Python revision levels as older browsers are dropped and newer, more popular ones are added. I believe there is a recent proposal to support edge, but it is not currently on the list. This is a problem. You can specify most common, but this may wind up starting edge, which probably won't display any Tonto2 info. Your alternative will be to install an alternative browser for use by Tonto2. May I suggest firefox. It usually produces a result that's similar to what is expected. Even so, Tonto2 may not be able to locate the browsers you actually have installed. You can provide the actual file location for your browser of choice if that helps. For example: browser = %%ProgramFiles%%\Google\Chrome\Application\chrome.exe *.ini-file syntax requires the double percent signs (%%). 8.4.9 Ini: current_tab_visualCurrent_tab_visual is set automatically by Tonto2. This is the name of the tab that was selected when you quit Tonto2, and it will be the first tab selected when you restart. 8.4.10 Ini: week_first_dayThis setting is significant for rendering the Calendar Month grid. Week_first_day is the ISO 8601 number for the leftmost day. This defaults to Sunday (7), but you can make it Monday (1) if you really want (Wikipedia, ISO 8601). |