�
��g�� � � � d dl mZmZ d dlZd dlZd dlmZ d dlmZ d dl m
Z
d dlmZ
d dlmZmZmZmZmZ d dlmZ d d lmZ d d
lmZmZ d dlmZ d dlmZ d dlZd dlZ ej e!� � Z"d
� Z#dZ$dZ%dZ&dZ'dZ(dod�Z) G d� de*� � Z+ G d� de+� � Z, G d� d edg d�� � � � Z- G d� d� � Z. G d� de+� � Z/ G d� d e/� � Z0 G d!� d"e/� � Z1 G d#� d$e+� � Z2 G d%� d&e+� � Z3 G d'� d(e+� � Z4 G d)� d*e+� � Z5 G d+� d,e+� � Z6 G d-� d.e+� � Z7 G d/� d0e+� � Z8 G d1� d2e+� � Z9 G d3� d4e*� � Z: G d5� d6e+� � Z; G d7� d8e+� � Z<d9� Z=d:� Z>d;� Z?d<� Z@dpd=�ZAd>� ZBd?� ZCd@� ZDdA� ZEdB� ZFdC� ZGdD� ZHdE� ZIdF� ZJdG� ZKdH� ZLdI� ZMdJ� ZNdK� ZOdL� ZPdqdM�ZQdN� ZRdqdO�ZSdP� ZTdQ� ZUdR� ZVdS� ZW edTdU� � ZXdV� ZYdW� ZZdX� Z[dY� Z\dZ� Z]d[� Z^d\� Z_d]� Z`d^� Zad_� Zb G d`� dae*� � Zc edbd� � Zd edcd� � Ze drde�Zfdsdf�Zgdsdg�Zhdtdh�Zi dudi�Zjdj� Zkdk� Zldl� Zmdm� Zndn� ZodS )v� )�
namedtuple�OrderedDictN)�fixedToFloat)�otRound)�ttLib)�otTables)�ValueRecord�valueRecordFormatDict�OTLOffsetOverflowError�
OTTableWriter�CountReference)�otBase)�STATNameStatement)�_compression_level_from_env�compact_lookup)�OpenTypeLibError)�reducec �� � | sdS t j � � } t t | � � |j �� � |_ n&# t $ r}t d|� d�� � |�d}~ww xY w|S )a Builds a coverage table.
Coverage tables (as defined in the `OpenType spec <https://docs.microsoft.com/en-gb/typography/opentype/spec/chapter2#coverage-table>`__)
are used in all OpenType Layout lookups apart from the Extension type, and
define the glyphs involved in a layout subtable. This allows shaping engines
to compare the glyph stream with the coverage table and quickly determine
whether a subtable should be involved in a shaping operation.
This function takes a list of glyphs and a glyphname-to-ID map, and
returns a ``Coverage`` object representing the coverage table.
Example::
glyphMap = font.getReverseGlyphMap()
glyphs = [ "A", "B", "C" ]
coverage = buildCoverage(glyphs, glyphMap)
Args:
glyphs: a sequence of glyph names.
glyphMap: a glyph name to ID map, typically returned from
``font.getReverseGlyphMap()``.
Returns:
An ``otTables.Coverage`` object or ``None`` if there are no glyphs
supplied.
N��keyzCould not find glyph z in font)�ot�Coverage�sorted�set�__getitem__�glyphs�KeyError�
ValueError)r �glyphMap�self�es �h/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/fontTools/otlLib/builder.py�
buildCoverager# s� � �8 � ��t�
�;�=�=�D�E��S��[�[�h�.B�C�C�C������ E� E� E��<��<�<�<�=�=�1�D�����E���� �Ks �(A �
A%�A � A%� � � � � c � � � � �dS d� � D � � � � sdS t � fd�� D � � � � s$J dt d� � D � � � � z � � �t j � � }� d j |_ ||_ � |_ t |j � � |_ |�<|xj t z c_ t |t � � s
J |� � �||_ n |j t z dk s
J d|z � � �|S )a Turns a collection of rules into a lookup.
A Lookup (as defined in the `OpenType Spec <https://docs.microsoft.com/en-gb/typography/opentype/spec/chapter2#lookupTbl>`__)
wraps the individual rules in a layout operation (substitution or
positioning) in a data structure expressing their overall lookup type -
for example, single substitution, mark-to-base attachment, and so on -
as well as the lookup flags and any mark filtering sets. You may import
the following constants to express lookup flags:
- ``LOOKUP_FLAG_RIGHT_TO_LEFT``
- ``LOOKUP_FLAG_IGNORE_BASE_GLYPHS``
- ``LOOKUP_FLAG_IGNORE_LIGATURES``
- ``LOOKUP_FLAG_IGNORE_MARKS``
- ``LOOKUP_FLAG_USE_MARK_FILTERING_SET``
Args:
subtables: A list of layout subtable objects (e.g.
``MultipleSubst``, ``PairPos``, etc.) or ``None``.
flags (int): This lookup's flags.
markFilterSet: Either ``None`` if no mark filtering set is used, or
an integer representing the filtering set to be used for this
lookup. If a mark filtering set is provided,
`LOOKUP_FLAG_USE_MARK_FILTERING_SET` will be set on the lookup's
flags.
Returns:
An ``otTables.Lookup`` object or ``None`` if there are no subtables
supplied.
Nc � � g | ]}|�|��S �N� )�.0�sts r"