Skip to content

alexeyev/gardiner2unicode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

19 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

gardiner2unicode: Mapping Egyptian Hieroglyphs

A Python 3.9+ package that

  • provides a convenient out-of-the-box way to access the mapping of Gardiner's Sign List codes to unicode IDs;
  • generates hieroglyphs as images.

A list of hieroglyphs was copied from this Wikipedia template.

A 2.06 version of NewGardiner font is used by default. Please note that since 2.05 its license is OFL 1.1.

One can use any other font with UnicodeGlyphGenerator.

Python 3.9+ PyPI version Downloads CI Ruff

Installation

pip install -U gardiner2unicode

Breaking changes in 1.0.0

  • UnicodeGlyphGenerator(bkgr_color=...) -> UnicodeGlyphGenerator(fill_color=...) (the argument is the text fill colour; the old name was misleading).
  • GardinerToUnicodeMap.to_gardiner_from_hex(hex=...) -> to_gardiner_from_hex(hex_code=...) (the previous name shadowed the built-in hex).
  • GardinerToUnicodeMap now precomputes all derived lookup tables at construction time, so every to_* method is an O(1) dictionary access (no @lru_cache, no per-call int(..., 16) / chr(...)).
  • Minimum supported Python is now 3.9.

Usage example

from gardiner2unicode import GardinerToUnicodeMap, UnicodeGlyphGenerator

g2u = GardinerToUnicodeMap()
print(g2u.to_unicode_hex("A1"))

ugg = UnicodeGlyphGenerator()
ugg.generate_image("๐“‰“", save_path_png="O3_image.png")

Output:

00013000

O3

How to cite

Please cite this repository if you use this work in your research.

@misc{gardiner2unicode2021alekseev,
  title     = {{alexeyev/gardiner2unicode: Mapping Egyptian Hieroglyphs}},
  author    = {Anton Alekseev}, 
  year      = {2021},
  url       = {https://github.com/alexeyev/gardiner2unicode},
  language  = {english},
  publisher = {GitHub}, 
  journal   = {GitHub repository},  
  howpublished = {\url{https://github.com/alexeyev/gardiner2unicode/}}, 
}

Development

Install the package together with the development dependencies and run the linter and the test suite:

pip install -e ".[dev]"
ruff check .
pytest

pytest is configured (see pyproject.toml) to also produce a coverage report.

Links

About

f("A1") = ๐“€€; also A1.png

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages