ttf-opensans
=============
.. |py| image:: https://img.shields.io/pypi/pyversions/ttf-opensans.svg
.. |license| image:: https://img.shields.io/pypi/l/ttf-opensans.svg
:target: https://github.com/Gorialis/ttf-opensans/blob/main/LICENSE
.. |status| image:: https://img.shields.io/pypi/status/ttf-opensans.svg
:target: https://pypi.python.org/pypi/ttf-opensans
|py| |license| |status|
ttf-opensans is a Python package vending the `Open Sans font by Steve Matteson <https://fonts.google.com/specimen/Open+Sans>`__.
It is intended for when you want to use the Open Sans font family without having to worry about availability on the target system.
The Open Sans font family and this package is licensed under the `Apache License, Version 2.0 <http://www.apache.org/licenses/LICENSE-2.0>`__.
Installation
-------------
This package can be installed through the following command:
.. code:: sh
python3 -m pip install -U ttf-opensans
Usage
------
The fonts are provided through instances of the ``TTFFont`` class.
You can either access a specific font style directly:
.. code:: python3
import ttf_opensans
my_font = ttf_opensans.OPENSANS_SEMIBOLDITALIC
Or you can use the helper function to find the most appropriate font style:
.. code:: python3
from ttf_opensans import opensans
my_font = opensans(font_weight=600, italic=True)
Once you have the font you want, you can access various attributes on it:
.. code:: python3
print(my_font.name) # "OpenSans-SemiBoldItalic"
print(my_font.weight) # 600
print(my_font.italic) # True
print(my_font.path) # pathlib.Path("<...>/site_packages/ttf_opensans/ttf/OpenSans-SemiBoldItalic.ttf")
You can also open the font for reading directly:
.. code:: python3
with my_font.open() as fp:
font_data = fp.read()
If you use the Python Imaging Library (Pillow), you can also directly get an ImageFont instance:
.. code:: python3
from PIL import Image, ImageDraw, ImageFont
with Image.new("RGB", (512, 512), (255, 255, 255)) as im:
draw = ImageDraw.Draw(im)
imagefont = my_font.imagefont(size=48)
draw.text(font=imagefont, fill=(0, 0, 0), xy=(0, 0), text="Hello World!")
Raw data
{
"_id": null,
"home_page": "https://github.com/Gorialis/ttf-opensans",
"name": "ttf-opensans",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.4.0",
"maintainer_email": "",
"keywords": "font fonts ttf",
"author": "Devon (Gorialis) R",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/ad/ee/50958ddd4139ddca88670873596d648ab1f4c90193cf3abb1cc82cd9bdad/ttf-opensans-2020.10.30.tar.gz",
"platform": "",
"description": "ttf-opensans\n=============\n\n.. |py| image:: https://img.shields.io/pypi/pyversions/ttf-opensans.svg\n\n.. |license| image:: https://img.shields.io/pypi/l/ttf-opensans.svg\n :target: https://github.com/Gorialis/ttf-opensans/blob/main/LICENSE\n\n.. |status| image:: https://img.shields.io/pypi/status/ttf-opensans.svg\n :target: https://pypi.python.org/pypi/ttf-opensans\n\n|py| |license| |status|\n\nttf-opensans is a Python package vending the `Open Sans font by Steve Matteson <https://fonts.google.com/specimen/Open+Sans>`__.\n\nIt is intended for when you want to use the Open Sans font family without having to worry about availability on the target system.\n\nThe Open Sans font family and this package is licensed under the `Apache License, Version 2.0 <http://www.apache.org/licenses/LICENSE-2.0>`__.\n\nInstallation\n-------------\n\nThis package can be installed through the following command:\n\n.. code:: sh\n\n python3 -m pip install -U ttf-opensans\n\nUsage\n------\n\nThe fonts are provided through instances of the ``TTFFont`` class.\n\nYou can either access a specific font style directly:\n\n.. code:: python3\n\n import ttf_opensans\n\n my_font = ttf_opensans.OPENSANS_SEMIBOLDITALIC\n\nOr you can use the helper function to find the most appropriate font style:\n\n.. code:: python3\n\n from ttf_opensans import opensans\n\n my_font = opensans(font_weight=600, italic=True)\n\nOnce you have the font you want, you can access various attributes on it:\n\n.. code:: python3\n\n print(my_font.name) # \"OpenSans-SemiBoldItalic\"\n print(my_font.weight) # 600\n print(my_font.italic) # True\n print(my_font.path) # pathlib.Path(\"<...>/site_packages/ttf_opensans/ttf/OpenSans-SemiBoldItalic.ttf\")\n\nYou can also open the font for reading directly:\n\n.. code:: python3\n\n with my_font.open() as fp:\n font_data = fp.read()\n\nIf you use the Python Imaging Library (Pillow), you can also directly get an ImageFont instance:\n\n.. code:: python3\n\n from PIL import Image, ImageDraw, ImageFont\n\n with Image.new(\"RGB\", (512, 512), (255, 255, 255)) as im:\n draw = ImageDraw.Draw(im)\n imagefont = my_font.imagefont(size=48)\n\n draw.text(font=imagefont, fill=(0, 0, 0), xy=(0, 0), text=\"Hello World!\")\n\n\n",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "ttf-opensans is a Python package vending the Open Sans font by Steve Matteson.",
"version": "2020.10.30",
"project_urls": {
"Code": "https://github.com/Gorialis/ttf-opensans",
"Download": "https://github.com/Gorialis/ttf-opensans/archive/v2020.10.30.tar.gz",
"Homepage": "https://github.com/Gorialis/ttf-opensans",
"Issue tracker": "https://github.com/Gorialis/ttf-opensans/issues"
},
"split_keywords": [
"font",
"fonts",
"ttf"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "00760a5a5f4700d1c2ee85e7afa209c3b53bbe5540bf7c06da605229e3676257",
"md5": "b13197f8358a17b0cb4764068d826291",
"sha256": "2ce65f171eb60fc16c15b31fc714cc5735533acb43b0637e5cebb612e2a9ac9c"
},
"downloads": -1,
"filename": "ttf_opensans-2020.10.30-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b13197f8358a17b0cb4764068d826291",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.4.0",
"size": 599758,
"upload_time": "2020-10-29T18:21:55",
"upload_time_iso_8601": "2020-10-29T18:21:55.375101Z",
"url": "https://files.pythonhosted.org/packages/00/76/0a5a5f4700d1c2ee85e7afa209c3b53bbe5540bf7c06da605229e3676257/ttf_opensans-2020.10.30-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "adee50958ddd4139ddca88670873596d648ab1f4c90193cf3abb1cc82cd9bdad",
"md5": "8a3278d2be0f9eb5b7864cd1fc51b827",
"sha256": "bbc6e8e1f354a8a20970cb9e2a6fbd10cf2e855c9194e1d59268487d7d4d1e83"
},
"downloads": -1,
"filename": "ttf-opensans-2020.10.30.tar.gz",
"has_sig": false,
"md5_digest": "8a3278d2be0f9eb5b7864cd1fc51b827",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.4.0",
"size": 602097,
"upload_time": "2020-10-29T18:21:56",
"upload_time_iso_8601": "2020-10-29T18:21:56.740419Z",
"url": "https://files.pythonhosted.org/packages/ad/ee/50958ddd4139ddca88670873596d648ab1f4c90193cf3abb1cc82cd9bdad/ttf-opensans-2020.10.30.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2020-10-29 18:21:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Gorialis",
"github_project": "ttf-opensans",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "ttf-opensans"
}