From 5bbb0d4c307bff58e9928a1c757438d033687ce3 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sat, 23 Apr 2022 16:03:02 -0400 Subject: Replace switch statements with static map initializers Character transcoding from Unicode to single-byte characters used hard-coded switch statements because the code predated our adoption of C++11. Now we have thread-safe, static initialization of map literals, so use that instead. --- TODO | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'TODO') diff --git a/TODO b/TODO index 956d1ef3..1cbf977f 100644 --- a/TODO +++ b/TODO @@ -11,9 +11,6 @@ In order: Other (do in any order): Misc -* Get rid of "ugly switch statements" in QUtil.cc -- replace with - static map initializers. (Search for "ugly switch statements" below - as well.) * Consider exposing get_next_utf8_codepoint in QUtil * Add QUtil::is_explicit_utf8 that does what QPDF_String::getUTF8Val does to detect UTF-8 encoded strings per PDF 2.0 spec. @@ -396,10 +393,9 @@ we might do about it. * When mapping characters to widths, we will need to care about character encoding. For built-in fonts, we can create a map from Unicode code point to width and then go from the font's encoding to - unicode to the width. Get rid of "ugly switch statements" in - QUtil.cc and replace with static map initializers. See - misc/character-encoding/ (not on github) and font metric information - for the 14 standard fonts in my local pdf-spec directory. + unicode to the width. See misc/character-encoding/ (not on github) + and font metric information for the 14 standard fonts in my local + pdf-spec directory. * Once we know about character widths, we can correctly support auto-sized variable text fields (0 Tf). If this is fixed, search for -- cgit v1.2.3-54-g00ecf