new ip
This commit is contained in:
@@ -0,0 +1 @@
|
||||
pip
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 apshu
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,107 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: Hershey-Fonts
|
||||
Version: 2.1.0
|
||||
Summary: Vector font package with built-in fonts and font rendering iterators
|
||||
Home-page: https://github.com/apshu/HersheyFonts
|
||||
Author: Attila
|
||||
Author-email: attila.kolinger@gmail.com
|
||||
License: MIT License
|
||||
Platform: all
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Programming Language :: Python :: 2.7
|
||||
Classifier: Topic :: Text Processing :: Fonts
|
||||
Classifier: Topic :: Multimedia :: Graphics
|
||||
Classifier: Topic :: Scientific/Engineering :: Visualization
|
||||
Classifier: Topic :: Scientific/Engineering
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: License :: OSI Approved :: MIT License
|
||||
Classifier: Operating System :: OS Independent
|
||||
Requires-Python: >=2.7
|
||||
Description-Content-Type: text/markdown
|
||||
License-File: LICENSE
|
||||
|
||||
# Hershey Font
|
||||
<br/>Hershey font is a python library with built in fonts and low level line and stroke iterators.
|
||||
|
||||
## What is Hershey Font?
|
||||
Hershey font is a vector font, designed many years ago.
|
||||
The main use today if for generating text for CNC engraving.
|
||||
|
||||
[Read more on Wikipedia](https://en.wikipedia.org/wiki/Hershey_fonts)
|
||||
|
||||
[Font samples](http://soft9000.com/HersheyShowcase/)
|
||||
## Overview
|
||||
Hershey font consists of _glyphs_, each _glyph_ is assigned to an ASCII value from 32 (`'space'`) until 32+number of _glyphs_.<br/>Each _glyph_ consits of array of **strokes**.<br/>A **stroke** is an array of zero or more continous lines (points of an openend or closed ploygon).
|
||||
## The Python module
|
||||
The Hershey-Font package is providing the `HersheyFonts` class.<br/>
|
||||
Great care was taken to be compatible with defulat installation of python 2.7 and python 3.<br/>
|
||||
The `HersheyFonts` instance is handling only one font at a time. If you need to use multiple type faces as the same time, you can load a new typeface anytime (even during rendering) or create another `HersheyFonts` instance.
|
||||
### Installing
|
||||
Sources available on [GitHub](https://github.com/apshu/HersheyFonts)
|
||||
Installation is available through pip and pip3
|
||||
```ShellSession
|
||||
#python 3
|
||||
pip3 install Hershey-Fonts
|
||||
|
||||
#python 2.7
|
||||
pip install Hershey-Fonts
|
||||
```
|
||||
### Demo
|
||||
After successfully installing the Hershey-Font package, you can run the module for a simple demonstration.
|
||||
```ShellSession
|
||||
#python 3
|
||||
python3 -m HersheyFonts
|
||||
|
||||
#python 2.7
|
||||
python -m HersheyFonts
|
||||
```
|
||||
|
||||
### Built-in fonts
|
||||
The python module 1.0.0 has **32 fonts included in the source code** as a compressed base64 encoded variable.
|
||||
The module can also load default fonts or from file and iterable string lines.
|
||||
When you make your own font and want to include in the package, please contact me.
|
||||
You can get the list of built-in fonts by looking at
|
||||
```Python
|
||||
from HersheyFonts import HersheyFonts
|
||||
|
||||
print(HersheyFonts().default_font_names)
|
||||
```
|
||||
The order and elements of the list may totally vary with any package release.
|
||||
### Loading a font
|
||||
To access one of the built-in fonts, use the `.load_default_font()` method. To read custome fonts you can call the `.load_font_file(file_name)` or `.read_from_string_lines(stringlines)` methods. The constructor also gives opportunity to read built-in or external font.
|
||||
```Python
|
||||
from HersheyFonts import HersheyFonts
|
||||
thefont = HersheyFonts()
|
||||
thefont.load_default_font('gothiceng')
|
||||
thefont.load_default_font(thefont.default_font_names[0])
|
||||
thefont.load_default_font() #Returns the name of the loaded font
|
||||
thefont.load_font_file('cyrillic.jhf')
|
||||
thefont.read_from_string_lines(arrayofstrings)
|
||||
```
|
||||
For more details and all options see doc comments in the sources.
|
||||
### Renderig the loaded font
|
||||
There are several options to convert a text to font data. The simplest way is to read endpoints of the lines returned by renderer method `.lines_for_text(sometext)`<br/>
|
||||
There are renderer methods returning list of glyps, list of strokes and list of line endpoints.
|
||||
> The renderers in version 1.0.0 support only single line texts.
|
||||
> Rendering is also affected by `.render_options` property.<br/>
|
||||
> There is a `.normalize_rendering()` method to automatically set the scaling and offsets for easy rendering.
|
||||
```Python
|
||||
# Minimalistic code for easy start
|
||||
from HersheyFonts import HersheyFonts
|
||||
def draw_line(x1, y1, x2, y2):
|
||||
︙
|
||||
︙
|
||||
|
||||
thefont = HersheyFonts()
|
||||
thefont.load_default_font()
|
||||
thefont.normalize_rendering(100)
|
||||
for (x1, y1), (x2, y2) in thefont.lines_for_text('Hello'):
|
||||
draw_line(x1, y1 ,x2 ,y2)
|
||||
```
|
||||
## The Hershey-Font API
|
||||
The API is documented in the source code.
|
||||
# Thank you
|
||||
Big thanks to all people working on maintaining this old format for the modern age.
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
../../../bin/HersheyFonts_demo,sha256=3hzE7Jim3OoL7ydgxaEu-2TJ6g04DWSA34mbZwBhFJY,280
|
||||
../../../bin/HersheyFonts_demo,sha256=3hzE7Jim3OoL7ydgxaEu-2TJ6g04DWSA34mbZwBhFJY,280
|
||||
HersheyFonts/HersheyFonts.py,sha256=9LgE6vvinAMBI8jK9RBXnFQSKNaJrqccDaMlqKLDB3U,91220
|
||||
HersheyFonts/__init__.py,sha256=OLgzADyQPZNjqDXDZ-nt7eyPPo59KyNL7GH3thhfPag,63
|
||||
HersheyFonts/__main__.py,sha256=6HPExSkNYZrdUvuM5rtnxYObi_l4WerM0Lk0how55DA,101
|
||||
HersheyFonts/__pycache__/HersheyFonts.cpython-38.pyc,,
|
||||
HersheyFonts/__pycache__/__init__.cpython-38.pyc,,
|
||||
HersheyFonts/__pycache__/__main__.cpython-38.pyc,,
|
||||
Hershey_Fonts-2.1.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
Hershey_Fonts-2.1.0.dist-info/LICENSE,sha256=RmGDhEj5lMwFXf30b9-xgsUuDQSbHXHK7iEP7MGwQaM,1062
|
||||
Hershey_Fonts-2.1.0.dist-info/METADATA,sha256=lfCFd2Mfw_gsd_86_dP4rhidduYOuk2CUxPStCsa2zc,4572
|
||||
Hershey_Fonts-2.1.0.dist-info/RECORD,,
|
||||
Hershey_Fonts-2.1.0.dist-info/WHEEL,sha256=WzZ8cwjh8l0jtULNjYq1Hpr-WCqCRgPr--TX4P5I1Wo,110
|
||||
Hershey_Fonts-2.1.0.dist-info/entry_points.txt,sha256=szi9OSlDeM-R5Kwbnl3gGj0I8QOQfSVG98Mtt4yP3So,143
|
||||
Hershey_Fonts-2.1.0.dist-info/top_level.txt,sha256=V14Zt7CKG2QYI3kBLPtDnJo96eUx7-Xf2eJiOnc0Urc,19
|
||||
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
tests/__pycache__/__init__.cpython-38.pyc,,
|
||||
tests/__pycache__/test_HersheyFonts.cpython-38.pyc,,
|
||||
tests/test_HersheyFonts.py,sha256=fwfTUsp2sPjm_7v_m73XR97biVrkW3ILjdODebbCpQw,4018
|
||||
@@ -0,0 +1,6 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.37.0)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py2-none-any
|
||||
Tag: py3-none-any
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
[console_scripts]
|
||||
HersheyFonts_demo = HersheyFonts.HersheyFonts:main_script
|
||||
|
||||
[gui_scripts]
|
||||
HersheyFonts_demo = HersheyFonts.HersheyFonts:main
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
HersheyFonts
|
||||
tests
|
||||
Reference in New Issue
Block a user