DEVELOPMENT_NOTES (2116B)
1 ## general 2 3 The variable prefix 'g_' means it's a global variable. 4 Although glib is linked as a shared library as a 5 dependency of fontconfig this prefix has nothing to do 6 with the glib library. glib is not used in lorids source 7 code. 8 9 ## concurrent threads 10 11 Running lorid from multiple threads at the same time 12 is possible as long as global variables are avoided. 13 Not strictly every global variable is meant. Rather 14 those that hold a value that is specific to the current 15 lorid execution. If global variables would be used 16 each thread would use the same global variable and overwrite 17 each others value. What a mess. 18 19 ## stderr messages 20 21 Text of the form '* failed' is a message for the developer. 22 The text before ' failed' is always a function name. 23 These messages will be printed by the macro LOG_DEBUG and 24 are only enabled when compiling with 'make debug'. 25 26 Furthermore text printed to stderr is either an ERR, WARN or INFO. 27 An ERR means the program can't continue execution because something is wrong. 28 A WARN means the program continues execution but recommends changing something. 29 An INFO is just a valuable information. 30 ERR, WARN and INFO messages can be directed at the developer or user. 31 32 ## comments 33 34 As a signal that a comment should stay I write it like this: 35 // INFO: ... 36 /* INFO: ... */ 37 38 ## functions that free 39 40 A function that frees memory is named '*_free'. It has to be safe 41 to pass a null pointer. 42 43 ## memory leaks 44 45 There is one more case where memory leaks are tolerated. The library 46 fontconfig produces memory leaks according to valgrind. Fixing these 47 memory leaks is out of the scope of this project. 48 49 ## font handling 50 51 If you specify a font somewhere and that font can't be found on your 52 system lorid will show an error and terminate instead of finding 53 an alternate font. 54 55 #### cho_style_font_desc_parse() 56 57 This function implements part of the Pango Markup described at 58 'https://docs.gtk.org/Pango/type_func.FontDescription.from_string.html'. 59 60 The website states: "FAMILY-LIST is a comma-separated list of families optionally terminated by a comma". 61 My implemenation allows only one family name.