# Determines the appropriate font size for given text and constraints
## pip install getbestfontsize
#### Tested against Windows 10 / Python 3.10 / Anaconda
### Automated Font Size Calculation:
The module automates the process of determining the appropriate font size for given text and constraints. This saves users from manually testing different font sizes and ensures a faster and more accurate selection.
### Flexibility with Constraints:
Users can specify maximum width and height constraints for the text, allowing them to control how the text fits within the given space.
### Optimal Text Rendering:
By providing the best-fitted font size, this module helps ensure that text appears legible and visually appealing, no matter the context or screen size.
### Efficient Caching:
The lru_cache decorator helps optimize the loading of fonts by caching previously loaded fonts, reducing the need to reload the same font multiple times during the same execution.
### Dynamic and Adaptive:
The module can adapt to different font files and text content, making it suitable for a wide range of fonts and text strings.
## HashList
```python
# Example usage:
from getbestfontsize import calculate_text_size
text = "Hello, World!"
fs = calculate_text_size(
text,
font_path=r"C:\Users\hansc\Downloads\CALIBRIB.TTF",
max_width=None,
max_height=100,
startfont=10,
)
print(fs)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/hansalemaos/getbestfontsize",
"name": "getbestfontsize",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "font,size,calculate",
"author": "Johannes Fischer",
"author_email": "aulasparticularesdealemaosp@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/c0/1b/268c2016ecb0d4237f35b087450d0ac0fcb86fbda22c14c7c9201b301be2/getbestfontsize-0.10.tar.gz",
"platform": null,
"description": "\r\n# Determines the appropriate font size for given text and constraints\r\n\r\n## pip install getbestfontsize \r\n\r\n#### Tested against Windows 10 / Python 3.10 / Anaconda \r\n\r\n\r\n### Automated Font Size Calculation: \r\n\r\nThe module automates the process of determining the appropriate font size for given text and constraints. This saves users from manually testing different font sizes and ensures a faster and more accurate selection.\r\n\r\n### Flexibility with Constraints: \r\n\r\nUsers can specify maximum width and height constraints for the text, allowing them to control how the text fits within the given space.\r\n\r\n### Optimal Text Rendering: \r\n\r\nBy providing the best-fitted font size, this module helps ensure that text appears legible and visually appealing, no matter the context or screen size.\r\n\r\n### Efficient Caching: \r\n\r\nThe lru_cache decorator helps optimize the loading of fonts by caching previously loaded fonts, reducing the need to reload the same font multiple times during the same execution.\r\n\r\n### Dynamic and Adaptive: \r\n\r\nThe module can adapt to different font files and text content, making it suitable for a wide range of fonts and text strings.\r\n\r\n\r\n\r\n\r\n## HashList\r\n\r\n```python\r\n# Example usage:\r\nfrom getbestfontsize import calculate_text_size\r\ntext = \"Hello, World!\"\r\nfs = calculate_text_size(\r\n text,\r\n font_path=r\"C:\\Users\\hansc\\Downloads\\CALIBRIB.TTF\",\r\n max_width=None,\r\n max_height=100,\r\n startfont=10,\r\n)\r\nprint(fs)\r\n\r\n\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Determines the appropriate font size for given text and constraints",
"version": "0.10",
"project_urls": {
"Homepage": "https://github.com/hansalemaos/getbestfontsize"
},
"split_keywords": [
"font",
"size",
"calculate"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2342df00d542d06d3f51fc343326ffa4a587f275cdc880a9727ed5bcee2fad0d",
"md5": "a55b7bccb753f2bb9b13ccd2d652bf39",
"sha256": "7dc10066457b3ad1df09bc562825176831645e6328cfa35b5faf6ed43ad75e43"
},
"downloads": -1,
"filename": "getbestfontsize-0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a55b7bccb753f2bb9b13ccd2d652bf39",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 23415,
"upload_time": "2023-07-17T04:49:48",
"upload_time_iso_8601": "2023-07-17T04:49:48.169985Z",
"url": "https://files.pythonhosted.org/packages/23/42/df00d542d06d3f51fc343326ffa4a587f275cdc880a9727ed5bcee2fad0d/getbestfontsize-0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c01b268c2016ecb0d4237f35b087450d0ac0fcb86fbda22c14c7c9201b301be2",
"md5": "b72f0c98f5cce920330ba0330084b03b",
"sha256": "b7866a0ef3c2c5bc18e78b8a9f9b996cd168a6051152dff0670139c0cd2124cb"
},
"downloads": -1,
"filename": "getbestfontsize-0.10.tar.gz",
"has_sig": false,
"md5_digest": "b72f0c98f5cce920330ba0330084b03b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 22845,
"upload_time": "2023-07-17T04:49:50",
"upload_time_iso_8601": "2023-07-17T04:49:50.093537Z",
"url": "https://files.pythonhosted.org/packages/c0/1b/268c2016ecb0d4237f35b087450d0ac0fcb86fbda22c14c7c9201b301be2/getbestfontsize-0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-17 04:49:50",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hansalemaos",
"github_project": "getbestfontsize",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "getbestfontsize"
}