Skip to content

Commit

Permalink
update the type __ttf_char_descriptor_t to improve the support for IAR
Browse files Browse the repository at this point in the history
  • Loading branch information
GorgonMeducer committed Sep 7, 2024
1 parent d150c20 commit d7af8d2
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 42 deletions.
2 changes: 1 addition & 1 deletion ARM.Arm-2D.pdsc
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
<file category="doc" name="documentation/index.html"/>
<file category="preIncludeGlobal" name="Library/Include/template/arm_2d_cfg.h" attr="config" version="1.3.9" />
<file category="utility" name="tools/img2c.py" attr="config" version="1.2.4"/>
<file category="utility" name="tools/ttf2c.py" attr="config" version="1.3.1"/>
<file category="utility" name="tools/ttf2c.py" attr="config" version="2.1.0"/>
<file category="other" name="tools/README.md" />
<file category="other" name="ReleaseNote.md" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ typedef struct {
int16_t iBearingY;
uint8_t chCodeLength;
uint8_t chUTF8[4];
} __ttf_char_descriptor_t;
} const __ttf_char_descriptor_t;

ARM_SECTION("arm2d.asset.FONT")
const static uint8_t c_bmpUTF8UserA1Font[] = {
Expand Down Expand Up @@ -128,7 +128,7 @@ const static uint8_t c_bmpUTF8UserA1Font[] = {
};

ARM_SECTION("arm2d.asset.FONT")
const static __ttf_char_descriptor_t c_tUTF8LookUpTableA1[] = {
static __ttf_char_descriptor_t c_tUTF8LookUpTableA1[] = {

{ 0, { 12, 18, }, 19, 2, 20, 1, {0x2b} },
{ 18, { 12, 3, }, 19, 2, 13, 1, {0x2d} },
Expand Down Expand Up @@ -424,7 +424,7 @@ const static uint8_t c_bmpUTF8UserA2Font[] = {
};

ARM_SECTION("arm2d.asset.FONT")
const static __ttf_char_descriptor_t c_tUTF8LookUpTableA2[] = {
static __ttf_char_descriptor_t c_tUTF8LookUpTableA2[] = {

{ 0, { 12, 18, }, 19, 2, 20, 1, {0x2b} },
{ 18, { 12, 3, }, 19, 2, 13, 1, {0x2d} },
Expand Down Expand Up @@ -787,7 +787,7 @@ const static uint8_t c_bmpUTF8UserA4Font[] = {
};

ARM_SECTION("arm2d.asset.FONT")
const static __ttf_char_descriptor_t c_tUTF8LookUpTableA4[] = {
static __ttf_char_descriptor_t c_tUTF8LookUpTableA4[] = {

{ 0, { 12, 18, }, 19, 2, 20, 1, {0x2b} },
{ 18, { 12, 3, }, 19, 2, 13, 1, {0x2d} },
Expand Down Expand Up @@ -1267,7 +1267,7 @@ const static uint8_t c_bmpUTF8UserA8Font[] = {
};

ARM_SECTION("arm2d.asset.FONT")
const static __ttf_char_descriptor_t c_tUTF8LookUpTableA8[] = {
static __ttf_char_descriptor_t c_tUTF8LookUpTableA8[] = {

{ 0, { 12, 18, }, 19, 2, 20, 1, {0x2b} },
{ 18, { 12, 3, }, 19, 2, 13, 1, {0x2d} },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ typedef struct {
int16_t iBearingY;
uint8_t chCodeLength;
uint8_t chUTF8[4];
} __ttf_char_descriptor_t;
} const __ttf_char_descriptor_t;

ARM_SECTION("arm2d.asset.FONT")
const static uint8_t c_bmpUTF8UserA1Font[] = {
Expand Down Expand Up @@ -155,7 +155,7 @@ const static uint8_t c_bmpUTF8UserA1Font[] = {
};

ARM_SECTION("arm2d.asset.FONT")
const static __ttf_char_descriptor_t c_tUTF8LookUpTableA1[] = {
static __ttf_char_descriptor_t c_tUTF8LookUpTableA1[] = {

{ 0, { 23, 36, }, 38, 5, 41, 1, {0x2b} },
{ 36, { 23, 5, }, 38, 5, 25, 1, {0x2d} },
Expand Down Expand Up @@ -517,7 +517,7 @@ const static uint8_t c_bmpUTF8UserA2Font[] = {
};

ARM_SECTION("arm2d.asset.FONT")
const static __ttf_char_descriptor_t c_tUTF8LookUpTableA2[] = {
static __ttf_char_descriptor_t c_tUTF8LookUpTableA2[] = {

{ 0, { 23, 36, }, 38, 5, 41, 1, {0x2b} },
{ 36, { 23, 5, }, 38, 5, 25, 1, {0x2d} },
Expand Down Expand Up @@ -1007,7 +1007,7 @@ const static uint8_t c_bmpUTF8UserA4Font[] = {
};

ARM_SECTION("arm2d.asset.FONT")
const static __ttf_char_descriptor_t c_tUTF8LookUpTableA4[] = {
static __ttf_char_descriptor_t c_tUTF8LookUpTableA4[] = {

{ 0, { 23, 36, }, 38, 5, 41, 1, {0x2b} },
{ 36, { 23, 5, }, 38, 5, 25, 1, {0x2d} },
Expand Down Expand Up @@ -1741,7 +1741,7 @@ const static uint8_t c_bmpUTF8UserA8Font[] = {
};

ARM_SECTION("arm2d.asset.FONT")
const static __ttf_char_descriptor_t c_tUTF8LookUpTableA8[] = {
static __ttf_char_descriptor_t c_tUTF8LookUpTableA8[] = {

{ 0, { 23, 36, }, 38, 5, 41, 1, {0x2b} },
{ 36, { 23, 5, }, 38, 5, 25, 1, {0x2d} },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
int16_t iBearingY;
uint8_t chCodeLength;
uint8_t chUTF8[4];
} __ttf_char_descriptor_t;
} const __ttf_char_descriptor_t;
"""


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ typedef struct {
int16_t iBearingY;
uint8_t chCodeLength;
uint8_t chUTF8[4];
} __ttf_char_descriptor_t;
} const __ttf_char_descriptor_t;

ARM_SECTION("arm2d.asset.FONT")
const static uint8_t c_bmpUTF8UserA1Font[] = {
Expand Down Expand Up @@ -124,7 +124,7 @@ const static uint8_t c_bmpUTF8UserA1Font[] = {
};

ARM_SECTION("arm2d.asset.FONT")
const static __ttf_char_descriptor_t c_tUTF8LookUpTableA1[] = {
static __ttf_char_descriptor_t c_tUTF8LookUpTableA1[] = {

{ 0, { 12, 18, }, 19, 2, 20, 1, {0x2b} },
{ 18, { 12, 3, }, 19, 2, 13, 1, {0x2d} },
Expand Down Expand Up @@ -420,7 +420,7 @@ const static uint8_t c_bmpUTF8UserA2Font[] = {
};

ARM_SECTION("arm2d.asset.FONT")
const static __ttf_char_descriptor_t c_tUTF8LookUpTableA2[] = {
static __ttf_char_descriptor_t c_tUTF8LookUpTableA2[] = {

{ 0, { 12, 18, }, 19, 2, 20, 1, {0x2b} },
{ 18, { 12, 3, }, 19, 2, 13, 1, {0x2d} },
Expand Down Expand Up @@ -783,7 +783,7 @@ const static uint8_t c_bmpUTF8UserA4Font[] = {
};

ARM_SECTION("arm2d.asset.FONT")
const static __ttf_char_descriptor_t c_tUTF8LookUpTableA4[] = {
static __ttf_char_descriptor_t c_tUTF8LookUpTableA4[] = {

{ 0, { 12, 18, }, 19, 2, 20, 1, {0x2b} },
{ 18, { 12, 3, }, 19, 2, 13, 1, {0x2d} },
Expand Down Expand Up @@ -1263,7 +1263,7 @@ const static uint8_t c_bmpUTF8UserA8Font[] = {
};

ARM_SECTION("arm2d.asset.FONT")
const static __ttf_char_descriptor_t c_tUTF8LookUpTableA8[] = {
static __ttf_char_descriptor_t c_tUTF8LookUpTableA8[] = {

{ 0, { 12, 18, }, 19, 2, 20, 1, {0x2b} },
{ 18, { 12, 3, }, 19, 2, 13, 1, {0x2d} },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ typedef struct {
int16_t iBearingY;
uint8_t chCodeLength;
uint8_t chUTF8[4];
} __ttf_char_descriptor_t;
} const __ttf_char_descriptor_t;

ARM_SECTION("arm2d.asset.FONT")
const static uint8_t c_bmpUTF8UserA1Font[] = {
Expand Down Expand Up @@ -151,7 +151,7 @@ const static uint8_t c_bmpUTF8UserA1Font[] = {
};

ARM_SECTION("arm2d.asset.FONT")
const static __ttf_char_descriptor_t c_tUTF8LookUpTableA1[] = {
static __ttf_char_descriptor_t c_tUTF8LookUpTableA1[] = {

{ 0, { 23, 36, }, 38, 5, 41, 1, {0x2b} },
{ 36, { 23, 5, }, 38, 5, 25, 1, {0x2d} },
Expand Down Expand Up @@ -513,7 +513,7 @@ const static uint8_t c_bmpUTF8UserA2Font[] = {
};

ARM_SECTION("arm2d.asset.FONT")
const static __ttf_char_descriptor_t c_tUTF8LookUpTableA2[] = {
static __ttf_char_descriptor_t c_tUTF8LookUpTableA2[] = {

{ 0, { 23, 36, }, 38, 5, 41, 1, {0x2b} },
{ 36, { 23, 5, }, 38, 5, 25, 1, {0x2d} },
Expand Down Expand Up @@ -1003,7 +1003,7 @@ const static uint8_t c_bmpUTF8UserA4Font[] = {
};

ARM_SECTION("arm2d.asset.FONT")
const static __ttf_char_descriptor_t c_tUTF8LookUpTableA4[] = {
static __ttf_char_descriptor_t c_tUTF8LookUpTableA4[] = {

{ 0, { 23, 36, }, 38, 5, 41, 1, {0x2b} },
{ 36, { 23, 5, }, 38, 5, 25, 1, {0x2d} },
Expand Down Expand Up @@ -1737,7 +1737,7 @@ const static uint8_t c_bmpUTF8UserA8Font[] = {
};

ARM_SECTION("arm2d.asset.FONT")
const static __ttf_char_descriptor_t c_tUTF8LookUpTableA8[] = {
static __ttf_char_descriptor_t c_tUTF8LookUpTableA8[] = {

{ 0, { 23, 36, }, 38, 5, 41, 1, {0x2b} },
{ 36, { 23, 5, }, 38, 5, 25, 1, {0x2d} },
Expand Down
4 changes: 2 additions & 2 deletions examples/[template][cmsis-rtos2]/RTE/Acceleration/ttf2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
int16_t iBearingY;
uint8_t chCodeLength;
uint8_t chUTF8[4];
} __ttf_char_descriptor_t;
} const __ttf_char_descriptor_t;
"""


Expand Down Expand Up @@ -372,7 +372,7 @@ def write_c_code(glyphs_data, output_file, name, char_max_width, char_max_height
f.write("0x00, " * (char_max_width * char_max_height))
f.write("\n};\n\n")

print("ARM_SECTION(\"arm2d.asset.FONT\")\nconst static __ttf_char_descriptor_t c_tUTF8LookUpTableA{0}[] = {{\n"
print("ARM_SECTION(\"arm2d.asset.FONT\")\nstatic __ttf_char_descriptor_t c_tUTF8LookUpTableA{0}[] = {{\n"
.format(font_bit_size), file=f)

last_index = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
int16_t iBearingY;
uint8_t chCodeLength;
uint8_t chUTF8[4];
} __ttf_char_descriptor_t;
} const __ttf_char_descriptor_t;
"""


Expand Down Expand Up @@ -385,7 +385,7 @@ def write_c_code(glyphs_data, output_file, name, char_max_width, char_max_height
f.write("0x00, " * (char_max_width * char_max_height))
f.write("\n};\n\n")

print("ARM_SECTION(\"arm2d.asset.FONT\")\nconst static __ttf_char_descriptor_t c_tUTF8LookUpTableA{0}[] = {{\n"
print("ARM_SECTION(\"arm2d.asset.FONT\")\nstatic __ttf_char_descriptor_t c_tUTF8LookUpTableA{0}[] = {{\n"
.format(font_bit_size), file=f)

last_index = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
int16_t iBearingY;
uint8_t chCodeLength;
uint8_t chUTF8[4];
} __ttf_char_descriptor_t;
} const __ttf_char_descriptor_t;
"""


Expand Down Expand Up @@ -385,7 +385,7 @@ def write_c_code(glyphs_data, output_file, name, char_max_width, char_max_height
f.write("0x00, " * (char_max_width * char_max_height))
f.write("\n};\n\n")

print("ARM_SECTION(\"arm2d.asset.FONT\")\nconst static __ttf_char_descriptor_t c_tUTF8LookUpTableA{0}[] = {{\n"
print("ARM_SECTION(\"arm2d.asset.FONT\")\nstatic __ttf_char_descriptor_t c_tUTF8LookUpTableA{0}[] = {{\n"
.format(font_bit_size), file=f)

last_index = 0;
Expand Down
10 changes: 5 additions & 5 deletions examples/common/asset/alarm_clock_font32.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ typedef struct {
int16_t iBearingY;
uint8_t chCodeLength;
uint8_t chUTF8[4];
} __ttf_char_descriptor_t;
} const __ttf_char_descriptor_t;

ARM_SECTION("arm2d.asset.FONT")
const static uint8_t c_bmpUTF8UserA1Font[] = {
Expand Down Expand Up @@ -124,7 +124,7 @@ const static uint8_t c_bmpUTF8UserA1Font[] = {
};

ARM_SECTION("arm2d.asset.FONT")
const static __ttf_char_descriptor_t c_tUTF8LookUpTableA1[] = {
static __ttf_char_descriptor_t c_tUTF8LookUpTableA1[] = {

{ 0, { 12, 18, }, 19, 2, 20, 1, {0x2b} },
{ 18, { 12, 3, }, 19, 2, 13, 1, {0x2d} },
Expand Down Expand Up @@ -361,7 +361,7 @@ const static uint8_t c_bmpUTF8UserA2Font[] = {
};

ARM_SECTION("arm2d.asset.FONT")
const static __ttf_char_descriptor_t c_tUTF8LookUpTableA2[] = {
static __ttf_char_descriptor_t c_tUTF8LookUpTableA2[] = {

{ 0, { 12, 18, }, 19, 2, 20, 1, {0x2b} },
{ 18, { 12, 3, }, 19, 2, 13, 1, {0x2d} },
Expand Down Expand Up @@ -666,7 +666,7 @@ const static uint8_t c_bmpUTF8UserA4Font[] = {
};

ARM_SECTION("arm2d.asset.FONT")
const static __ttf_char_descriptor_t c_tUTF8LookUpTableA4[] = {
static __ttf_char_descriptor_t c_tUTF8LookUpTableA4[] = {

{ 0, { 12, 18, }, 19, 2, 20, 1, {0x2b} },
{ 18, { 12, 3, }, 19, 2, 13, 1, {0x2d} },
Expand Down Expand Up @@ -1088,7 +1088,7 @@ const static uint8_t c_bmpUTF8UserA8Font[] = {
};

ARM_SECTION("arm2d.asset.FONT")
const static __ttf_char_descriptor_t c_tUTF8LookUpTableA8[] = {
static __ttf_char_descriptor_t c_tUTF8LookUpTableA8[] = {

{ 0, { 12, 18, }, 19, 2, 20, 1, {0x2b} },
{ 18, { 12, 3, }, 19, 2, 13, 1, {0x2d} },
Expand Down
10 changes: 5 additions & 5 deletions examples/common/asset/alarm_clock_font64.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ typedef struct {
int16_t iBearingY;
uint8_t chCodeLength;
uint8_t chUTF8[4];
} __ttf_char_descriptor_t;
} const __ttf_char_descriptor_t;

ARM_SECTION("arm2d.asset.FONT")
const static uint8_t c_bmpUTF8UserA1Font[] = {
Expand Down Expand Up @@ -151,7 +151,7 @@ const static uint8_t c_bmpUTF8UserA1Font[] = {
};

ARM_SECTION("arm2d.asset.FONT")
const static __ttf_char_descriptor_t c_tUTF8LookUpTableA1[] = {
static __ttf_char_descriptor_t c_tUTF8LookUpTableA1[] = {

{ 0, { 23, 36, }, 38, 5, 41, 1, {0x2b} },
{ 36, { 23, 5, }, 38, 5, 25, 1, {0x2d} },
Expand Down Expand Up @@ -454,7 +454,7 @@ const static uint8_t c_bmpUTF8UserA2Font[] = {
};

ARM_SECTION("arm2d.asset.FONT")
const static __ttf_char_descriptor_t c_tUTF8LookUpTableA2[] = {
static __ttf_char_descriptor_t c_tUTF8LookUpTableA2[] = {

{ 0, { 23, 36, }, 38, 5, 41, 1, {0x2b} },
{ 36, { 23, 5, }, 38, 5, 25, 1, {0x2d} },
Expand Down Expand Up @@ -885,7 +885,7 @@ const static uint8_t c_bmpUTF8UserA4Font[] = {
};

ARM_SECTION("arm2d.asset.FONT")
const static __ttf_char_descriptor_t c_tUTF8LookUpTableA4[] = {
static __ttf_char_descriptor_t c_tUTF8LookUpTableA4[] = {

{ 0, { 23, 36, }, 38, 5, 41, 1, {0x2b} },
{ 36, { 23, 5, }, 38, 5, 25, 1, {0x2d} },
Expand Down Expand Up @@ -1561,7 +1561,7 @@ const static uint8_t c_bmpUTF8UserA8Font[] = {
};

ARM_SECTION("arm2d.asset.FONT")
const static __ttf_char_descriptor_t c_tUTF8LookUpTableA8[] = {
static __ttf_char_descriptor_t c_tUTF8LookUpTableA8[] = {

{ 0, { 23, 36, }, 38, 5, 41, 1, {0x2b} },
{ 36, { 23, 5, }, 38, 5, 25, 1, {0x2d} },
Expand Down
2 changes: 1 addition & 1 deletion examples/common/asset/arial_ascii_font14.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ typedef struct {
int16_t iBearingY;
uint8_t chCodeLength;
uint8_t chUTF8[4];
} __ttf_char_descriptor_t;
} const __ttf_char_descriptor_t;

ARM_SECTION("arm2d.asset.FONT")
const uint8_t c_bmpUTF8Arial14A1Font[] = {
Expand Down
6 changes: 3 additions & 3 deletions tools/ttf2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
int16_t iBearingY;
uint8_t chCodeLength;
uint8_t chUTF8[4];
} __ttf_char_descriptor_t;
} const __ttf_char_descriptor_t;
"""


Expand Down Expand Up @@ -357,7 +357,7 @@ def write_c_code(glyphs_data, output_file, name, char_max_width, char_max_height
f.write("0x00, " * (char_max_width * char_max_height))
f.write("\n};\n\n")

print("ARM_SECTION(\"arm2d.asset.FONT\")\n const __ttf_char_descriptor_t c_tUTF8{0}LookUpTableA{1}[] = {{\n"
print("ARM_SECTION(\"arm2d.asset.FONT\")\n __ttf_char_descriptor_t c_tUTF8{0}LookUpTableA{1}[] = {{\n"
.format(name, font_bit_size), file=f)

last_index = 0;
Expand All @@ -384,7 +384,7 @@ def write_c_code(glyphs_data, output_file, name, char_max_width, char_max_height


def main():
parser = argparse.ArgumentParser(description='TrueTypeFont to C array converter (v2.0.0)')
parser = argparse.ArgumentParser(description='TrueTypeFont to C array converter (v2.1.0)')
parser.add_argument("-i", "--input", type=str, help="Path to the TTF file", required=True)
parser.add_argument("--index", type=int, help="The Font Index in a TTC file", required=False, default=0)
parser.add_argument("-t", "--text", type=str, help="Path to the text file", required=True)
Expand Down

0 comments on commit d7af8d2

Please sign in to comment.