8000 Publish to PyPi. · mcauser/micropython-font-to-py@c247614 · GitHub
[go: up one dir, main page]

Skip to content

Commit c247614

Browse files
committed
Publish to PyPi.
1 parent f79459e commit c247614

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

FONT_TO_PY.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ A PC utility for converting industry standard font files to Python source code.
66

77
1. [Introdction](./FONT_TO_PY.md#1-introduction) Creating Python fonts.
88
1.1 [Revision history](./FONT_TO_PY.md#11-revision-history)
9-
2. [Dependencies](./FONT_TO_PY.md#2-dependencies) Installation.
9+
2. [Installation](./FONT_TO_PY.md#2-installation)
1010
3. [Usage](./FONT_TO_PY.md#3-usage)
1111
3.1 [Arguments](./FONT_TO_PY.md#31-arguments)
1212
     3.1.1 [Mandatory positional arguments](./FONT_TO_PY.md#311-mandatory-positional-arguments)
@@ -34,10 +34,14 @@ alternative which is a random access binary file on the filesystem.
3434
The format of the Python font file is designed to save large amounts of RAM on
3535
resource-limited targets: the font file may be incorporated into a firmware
3636
build such that it occupies flash memory rather than scarce RAM. Python code
37-
built into firmware is known as frozen bytecode.
37+
built into firmware is known as frozen bytecode. An alternative is
38+
[romfs](https://docs.micropython.org/en/latest/reference/mpremote.html#mpremote-command-romfs).
39+
This achieves the same RAM efficiency as frozen bytecode without the need to
40+
recompile.
3841

3942
## 1.1 Revision history
4043

44+
28 May 2025 V0.42.2 Publish to PyPi, update docs.
4145
22 Mar 2024 V0.42 Default mapping is now horizontal.
4246
30 Jan 2023 V0.41 With thanks to @ferrolive (Igor Oliveira) who supplied the
4347
charset file.
@@ -69,14 +73,12 @@ API is unchanged.
6973
###### [Main README](./README.md)
7074
###### [Contents](./FONT_TO_PY.md#0-contents)
7175

72-
# 2. Dependencies
76+
# 2. Installation
7377

74-
The utility requires Python 3.2 or greater, also [freetype-py](https://github.com/rougier/freetype-py) which may be
75-
installed using `pip3`. On Linux (you may need a root prompt):
78+
The utility requires Python 3.6 or greater. It is installed using pip:
7679

7780
```shell
78-
# apt-get install python3-pip
79-
# pip install freetype-py
81+
$ pip install font_to_py
8082
```
8183

8284
# 3. Usage
@@ -302,7 +304,8 @@ The `foo()` function emulates the behaviour of a device driver in rendering a
302304
character to a display. The local variables constitute memory which is
303305
reclaimed on exit from the function. Its additional RAM use was 16 bytes.
304306

305-
Similar figures were found in recent (2019) testing on a Pyboard D.
307+
Similar figures were found in testing on a Pyboard D. Also using `romfs` instead
308+
of freezing bytecode.
306309

307310
## Conclusion
308311

font_to_py.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
# The MIT License (MIT)
1313
#
14-
# Copyright (c) 2016-2024 Peter Hinch
14+
# Copyright (c) 2016-2025 Peter Hinch
1515
#
1616
# Permission is hereby granted, free of charge, to any person obtaining a copy
1717
# of this software and associated documentation files (the "Software"), to deal
@@ -634,7 +634,8 @@ def quit(msg):
634634
Random access font files don't support an error character.
635635
"""
636636

637-
if __name__ == "__main__":
637+
638+
def main():
638639
parser = argparse.ArgumentParser(
639640
__file__, description=DESC, formatter_class=argparse.RawDescriptionHelpFormatter
640641
)
@@ -778,3 +779,7 @@ def quit(msg):
778779
sys.exit(1)
779780

780781
print(args.outfile, "written successfully.")
782+
783+
784+
if __name__ == "__main__":
785+
main()

0 commit comments

Comments
 (0)
0