Fix #514 Print Character with ZapfDingbats font

This commit is contained in:
Fred Natzke
2022-12-13 14:22:30 +10:00
parent f5fe39b285
commit 620fa9b8cc
11 changed files with 895 additions and 555 deletions

View File

@@ -182,9 +182,16 @@
private MacExpertEncoding()
{
foreach (var valueTuple in EncodingTable)
foreach ((var codeToBeConverted, var name) in EncodingTable)
{
Add(OctalHelpers.FromOctalInt(valueTuple.Item1), valueTuple.Item2);
// In source code an int literal with a leading zero ('0')
// in other languages ('C' and 'Java') would be interpreted
// as octal (base 8) and converted but C# does not support and
// so arrives here as a different value parsed as base10.
// Convert 'codeToBeConverted' to intended value as if it was an octal literal before using.
// For example 040 converts to string "40" then convert string to int again but using base 8 (octal) so result is 32 (base 10).
var code = System.Convert.ToInt32($"{codeToBeConverted}", 8); // alternative is OctalHelpers.FromOctalInt()
Add(code, name);
}
}
}