diff --git a/apps/i18n.py b/apps/i18n.py index dd307b8ba..8aee99be6 100644 --- a/apps/i18n.py +++ b/apps/i18n.py @@ -85,14 +85,20 @@ def print_implementation(data, path, locales): f = open(path, "w") f.write("#include \"i18n.h\"\n") f.write("#include \n") - f.write("#include \n\n"); + f.write("#include \n\n") f.write("namespace I18n {\n\n") + # Write the default message f.write("constexpr static char universalDefault[] = {0};\n") + # Write the universal messages for message in data["universal_messages"]: - f.write("constexpr static char universal" + message + "[] = " + data["data"]["universal"][message] + ";\n") + f.write("constexpr static char universal" + message + "[] = ") + f = open(path, "ab") # Re-open the file as binary to output raw UTF-8 bytes + f.write(data["data"]["universal"][message]) + f = open(path, "a") # Re-open the file as text + f.write(";\n") f.write("\n") f.write("constexpr static const char * universalMessages[%d] = {\n" % (len(data["universal_messages"])+1)) f.write(" universalDefault,\n") @@ -123,19 +129,8 @@ def print_implementation(data, path, locales): f.write("},\n") f.write("};\n\n") + # Write the translate method - for message in data["universal_messages"]: - f.write("constexpr static char universal" + message + "[] = ") - f = open(path, "ab") # Re-open the file as binary to output raw UTF-8 bytes - f.write(data["data"]["universal"][message]) - f = open(path, "a") # Re-open the file as text - f.write(";\n") - f.write("\n") - f.write("constexpr static const char * universalMessages[%d] = {\n" % len(data["universal_messages"])) - for message in data["universal_messages"]: - f.write(" universal" + message + ",\n") - f.write("};\n") - f.write("\n") f.write("const char * translate(Message m, Language l) {\n") f.write(" assert(m != Message::LocalizedMessageMarker);\n") f.write(" int localizedMessageOffset = (int)Message::LocalizedMessageMarker+1;\n") diff --git a/kandinsky/src/font.cpp b/kandinsky/src/font.cpp index 2e5a88321..b6c43151d 100644 --- a/kandinsky/src/font.cpp +++ b/kandinsky/src/font.cpp @@ -64,7 +64,7 @@ void KDFont::colorizeGlyphBuffer(const RenderPalette * renderPalette, GlyphBuffe KDColor * colorBuffer = glyphBuffer->colorBuffer(); uint8_t mask = (0xFF >> (8-k_bitsPerPixel)); - int pixelIndex = pixelCount; // Let's start at the final pixel + int pixelIndex = m_glyphSize.width() * m_glyphSize.height() - 1; // Let's start at the final pixel int greyscaleByteIndex = pixelIndex * k_bitsPerPixel / 8; while (pixelIndex >= 0) { assert(greyscaleByteIndex == pixelIndex * k_bitsPerPixel / 8);