From d78dc80c64ae6d4b1f035fc4ecdb9142cbd5c0d4 Mon Sep 17 00:00:00 2001 From: Fabio Caccamo Date: Mon, 18 Dec 2023 12:16:04 +0100 Subject: [PATCH] Update `CHANGELOG` and version. --- CHANGELOG.md | 6 ++++++ README.md | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b2d272f..684d1dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +get_variable_instance_by_style_name + +## [0.17.1](https://github.com/fabiocaccamo/python-fontbro/releases/tag/0.17.1) - 2023-12-18 +- Add `get_variable_instance_by_style_name` method. +- Increase tests coverage. + ## [0.17.0](https://github.com/fabiocaccamo/python-fontbro/releases/tag/0.17.0) - 2023-12-13 - Add `Python 3.12` support. - Add `get_family_name` / `set_family_name` methods. diff --git a/README.md b/README.md index d78fa92..90b109f 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ with open("fonts/MyFont.ttf") as fh: - [`get_variable_axes_tags`](#get_variable_axes_tags) - [`get_variable_axis_by_tag`](#get_variable_axis_by_tag) - [`get_variable_instances`](#get_variable_instances) +- [`get_variable_instance_by_style_name`](#get_variable_instance_by_style_name) - [`get_variable_instance_closest_to_coordinates`](#get_variable_instance_closest_to_coordinates) - [`get_version`](#get_version) - [`get_weight`](#get_weight) @@ -476,6 +477,20 @@ Gets the variable instances. instances = font.get_variable_instances() ``` +#### `get_variable_instance_by_style_name` +```python +""" +Gets the variable instance by style name, eg. style_name = 'Bold' + +:param style_name: The style name +:type style_name: str + +:returns: The variable instance matching the given style name. +:rtype: str or None +""" +instance = font.get_variable_instance_by_style_name(style_name="Bold") +``` + #### `get_variable_instance_closest_to_coordinates` ```python """