summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Update component version for releaseHEADrelease/0.1.0masterVincent Sanders2023-12-271-1/+1
|
* Tweak RISC OS host detection for new tooling.John-Mark Bell2022-06-022-3/+3
| | | | | The new toolchain has a different machine triplet, so update the things that care about it to work either way.
* Modernize loggingJohn-Mark Bell2022-06-022-10/+12
| | | | | | | | | | | | Ensure that only one copy of the storage for the log state is needed (previously, it injected these into every compilation unit, which now results in compiler warnings). Replace __PRETTY_FUNCTION__ with the standardised __func__. The output is the same in either case in our usage here (and testing all the way back to GCC 3.4.6 yields no difference in output). This also fixes compilation with GCC 10 (which warns about the use of __PRETTY_FUNCTION__ in -pedantic mode).
* Substitution table/CHD: fix build with GCC 10.John-Mark Bell2022-06-021-6/+6
| | | | | Modern GCC correctly warned about a narrowing cast. This was unnecessary, so rework the code to stop using it.
* Substitution table/direct: handle >255 fontsJohn-Mark Bell2022-05-304-2/+104
| | | | | | The direct substitution table constructor failed to allocate sufficient space to store the table in the case where there are more than 255 fonts installed on the system.
* Fix error conditions in broken FEC caseJohn-Mark Bell2022-05-271-4/+7
|
* Partially revert public API type changesJohn-Mark Bell2022-05-279-57/+55
| | | | | | | | | | | | | a4c41198 made a variety of consistency changes to the public API, including changing the type of the "string" parameter passed to many entry points from const char * to const uint8_t *, as that better reflects the data. However, this then forces the user of the API to explicitly cast when passing string constants, or other strings (which, would be passed to standard library APIs as const char *, even if UTF-8 encoded). Revert this part of the change so the type of "string" is once more const char * and cast to the type we actually want internally.
* Dump substitution table glyph count, per-plane sizeJohn-Mark Bell2022-05-231-9/+62
| | | | | This allows us to see the total extent of glyph coverage and which planes are the largest.
* Don't build/run unit tests when building for RISC OSJohn-Mark Bell2022-05-221-5/+7
| | | | | | | | UnixLib does not provide the POSIX extensions we're using here (and we can't run these tests without an emulator when cross-compiling, anyway). Take the easy option and disable them (and neuter the test runner, too, as the tests it wants to run don't exist).
* Add checks for rufl_glyph_metricsJohn-Mark Bell2022-05-223-0/+36
|
* Add trivial paint checkJohn-Mark Bell2022-05-224-1/+13
| | | | | Doesn't really do much more than ensure the code doesn't explode. It's kinda hard to meaningfully make assertions here, however.
* Add checks for font bbox measurementJohn-Mark Bell2022-05-223-0/+24
|
* Add checks for replacement character generationJohn-Mark Bell2022-05-223-0/+24
| | | | | Two variants, as astral characters require an additional pair of hex digits.
* Report astral characters in Font_EnumerateCharactersJohn-Mark Bell2022-05-221-2/+2
| | | | Thus ensuring that the UCS FM tests exercise the relevant code
* Add a test for a broken encoding fileJohn-Mark Bell2022-05-224-2/+36
| | | | | | | | | | | | | | This file is broken in a number of ways: * It contains garbage content that does not form valid glyph name specifiers * It contains garbage directives * It tries to define more than 256 glyphs (which is not supported by non-UCS FontManagers) The latter point above uncovered a bug in the umap sanity checking where it failed to properly count the number of glyph indices being defined by the Encoding file.
* Add test for symbol fontsJohn-Mark Bell2022-05-225-22/+64
|
* Add test to ensure identical umaps are mergedJohn-Mark Bell2022-05-222-0/+41
|
* Add test for fonts with no encodings at allJohn-Mark Bell2022-05-223-0/+23
| | | | | | | | This exposed a failure to clean up any FontManager error occurring when attempting to load this kind of font. Additionally, it also exposed a failure to initialise the umap count in an internal structure. This was probably harmless in reality, but caused the test to fail.
* Expand non-UCS tests to check umap loadingJohn-Mark Bell2022-05-227-10/+307
| | | | | These now take a configuration file defining the available encodings for each face and setting the expected number of umaps.
* Initialise pointers with NULLJohn-Mark Bell2022-05-221-7/+7
|
* Start brute-force scan at codepoint 1John-Mark Bell2022-05-221-1/+1
| | | | | There's no point starting at 0, as it is not a valid codepoint and will never be valid.
* Fix Font_EnumerateCharacters mockJohn-Mark Bell2022-05-221-15/+26
|
* Conditionally support UCS Encoding formatsJohn-Mark Bell2022-05-221-2/+17
| | | | | | | | | | While the Encoding file parser is able to parse UCS glyph "names" (of the form /uniXXXX or /uXXXX[XXXX]) and the sparse Encoding file format supported by the UCS FontManager, we currently only parse Encoding files at all on systems running a non-UCS FontManager and thus these code paths are unreachable. Guard them with appropriate preprocessor definitions so that we can easily resurrect them if they are ever needed in future.
* Add checks for reinitialising library.John-Mark Bell2022-05-225-5/+33
| | | | | | This will cause the second initialisation attempt to load the cache file. In doing so, we discover that cache loading on non-32bit platforms didn't work -- fix that, too.
* Squash leaks in non-UCS FM caseJohn-Mark Bell2022-05-222-0/+8
|
* Add test for initialisation on non-UCS FMJohn-Mark Bell2022-05-229-6/+396
|
* Fix x_to_offset/split checksJohn-Mark Bell2022-05-223-21/+40
| | | | | | | | | | The Font_ScanString mock was deficient here, refusing to return the split point in the x_to_offset case. Additionally, the tests themselves were passing entirely the wrong units into the API. Further, the Font_EnumerateCharacters mock needed updating to ensure that all the codepoints used in the tests have glyphs defined (as otherwise, we fall down the missing glyph path). Given all of this, it's somewhat miraculous these checks passed.
* Add test for initialisation on pre-3.64 UCS FMJohn-Mark Bell2022-05-215-0/+131
| | | | | | | This exercises the broken Font_EnumerateCharacters workaround. Ensure tests don't trample on each other by having them run in a temporary directory.
* Expand test to cover more APIJohn-Mark Bell2022-05-212-2/+93
|
* Size CHD bitmap correctly.John-Mark Bell2021-09-141-1/+2
| | | | | | Running tests under valgrind reveals that we were failing to size the CHD bitmap correctly, resulting in the opportunity for buffer overruns. Stop that happening by correcting the maths.
* Test UCS FontManager initialisationJohn-Mark Bell2021-09-144-23/+110
| | | | | Implement XOSFS_CanonicalisePath and XFont_ScanString and introduce a new test that uses them.
* Ensure there is at least one menu entryJohn-Mark Bell2021-09-141-4/+14
| | | | | In the case where there are no fonts at all on the system, ensure the menu building code copes.
* Introduce test harness and mock more FontManagerJohn-Mark Bell2021-09-147-52/+406
| | | | | | It is now possible to initialise a test harness which mimics the behaviour of the various versions of the FontManager we support. Rename the simple test to reflect its new purpose.
* Introduce test infrastructureJohn-Mark Bell2021-08-166-2/+456
| | | | | | Mock out every OS call made by the library (they all return an unimplemented error for the timebeing). Add a trivial test case that verifies that rufl_init() fails.
* RUfl_chars: fix undersized bufferJohn-Mark Bell2021-08-151-1/+1
| | | | | | Compiling for other platforms has its benefits. The first of which is x86_64 gcc rightly complaining that the buffer to receive the error message is too small. Make it big enough.
* Make it possible to build for non-RISC OS hostsJohn-Mark Bell2021-08-151-1/+10
| | | | | Linking fails, and the path to the OSLib headers is hard-coded, but it's a start.
* Link RISC OS test binaries staticallyJohn-Mark Bell2021-08-151-0/+1
|
* Don't assume pointers are 32bits wideJohn-Mark Bell2021-08-151-2/+2
| | | | | Use uintptr_t to cast between pointers and integers, instead of assuming that uint32_t will suffice.
* Restrict total font faces to 16 bit rangeJohn-Mark Bell2021-08-151-1/+3
| | | | | | The substitution tables expect there to be no more than 65535 font faces available. Enforce this at load, so there aren't any unwanted surprises later.
* Clean up types in internal structuresJohn-Mark Bell2021-08-152-11/+11
|
* Clean up types in public APIJohn-Mark Bell2021-08-157-58/+66
|
* Make dump of unicode maps optionalJohn-Mark Bell2021-08-153-4/+4
| | | | | | | | | Add a verbose flag to rufl_dump_state() and use it to control whether to dump the individual unicode maps generated when using a non-UCS Font Manager. Change rufl_test to not dump this state (ordinarily, anyway) as it is generally uninteresting and highly verbose.
* Ignore UCS fonts if using a non-UCS Font ManagerJohn-Mark Bell2021-08-151-2/+27
| | | | | | | | Attempting to use fonts constructed for the UCS Font Manager on older systems generally results in bad outcomes up to, and including, complete system freezes. As fixing the Font Manager on these systems is impractical, simply ignore these fonts completely when scanning for glyph coverage.
* Clean up logging in the non-UCS Font Manager pathJohn-Mark Bell2021-08-151-43/+39
| | | | | | | | | | | | | | | | | | | | | To obtain the full extent of a "language" font's glyph coverage we need to open and scan it in each of the available target encodings. All of the Latin1-6 + Welsh target encodings declare that they are based on the Base0 encoding and thus will cause the Font Manager to demand the existence of corresponding IntMetric0/Outlines0 font data files. A "language" font using a different base encoding (and corresponding target encodings based on it) would thus generate an error from the Font Manager. Additionally, without reinventing the Font Manager's own logic (and poking around the filesystem looking for IntMetrics and Encoding files), we don't know if a font is a "language" or a "symbol" font until we try to use it. Thus, we expect attempts to open "symbol" fonts with an explicit target encoding to generate an error from the Font Manager as well. As these are expected errors, there is no point logging them as it just produces a load of distracting noise.
* Accept non-UCS Font Manager rejecting UCS fonts.John-Mark Bell2021-08-141-2/+8
| | | | | | | If you attempt to use fonts supported by the UCS Font Manager with a non-UCS Font Manager, this will either work (in a limited way) or fail because the font data is incomprehensible to the non-UCS Font Manager. Cope with one particular instance of this.
* Fix font scanning on non-UCS Font ManagersJohn-Mark Bell2021-08-141-1/+1
| | | | | We want to update the umap itself not whatever happens to be on the stack in the vicinity of its address.
* Fix initialisation on UCS Font Manager 3.41-3.63John-Mark Bell2021-08-141-13/+50
| | | | | | | | | | | | | | | | | | | We cannot use Font_ReadEncodingFile to find the path to a font's source encoding because that is not what the API returns (it returns the path to the encoding file corresponding to the target encoding used to open the font handle) and there is no public API for obtaining the path of the source encoding. Additionally, there is no reliable way to replicate the UCS Font Manager's mapping of undefined and duplicate glyph names into the private use space at U+E000-U+EFFF. Therefore, take a different approach to supporting these versions of the Font Manager: abuse Font_EnumerateCharacters by probing every codepoint in the range [0, first_returned) to force the Font Manager to reveal the information we want. Once we have reached the first_returned codepoint, we can happily fall through to the normal flow (which will make use of the sparse nature of the Unicode space).
* Fix shrinkwrap moving blocksJohn-Mark Bell2021-08-141-23/+18
| | | | | All blocks subsequent to a full one get moved up and all their indices need rewriting.
* Ensure dumping doesn't run off the end of a planeJohn-Mark Bell2021-08-141-1/+1
|
* Fix bug in sparse encoding parserJohn-Mark Bell2021-08-141-2/+3
| | | | | Spaces are valid characters in the sparse encoding so ensure we consume them correctly.