
    hc                    (   S SK Jr  S SKJrJrJr  S SKrS SKrS SKrS SK	r	S SK
r
S SKJr  SSKJr  SSKJrJrJrJr  SSKJr  SS	KJr  SS
KJrJr  \(       a  S SKJr  S SKJrJr  \R@                  " S5      r!Sr"Sq#Sr$\" 5       r0 SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_S S!_S"S!_S#S$_S%S$_S&S'_S(S'_S)S*_S*S+S+S,S,S-S-S.S.S/S/S0.Er%S1S1S2.r&\%RO                  5        V Vs0 s H  u  pU RQ                  S35      (       d  M  X_M!     snn r)S4r*S5r+S6r,SaS7 jr-SaS8 jr.SbS9 jr/ScS: jr0SdS; jr1SeS< jr2SfSeS= jjr3SgS> jr4ShSeS? jjr5SfSiS@ jjr6SASBSCSDSSE.           SjSF jjr7SkSG jr8SH r9SI r:SdSJ jr;SlSK jr<SmSL jr=SmSM jr> " SN SO\R~                  5      r@ " SP SQ5      rA " SR SS\A5      rB " ST SU\A\R                  5      rD " SV SW\D5      rE " SX SY\D5      rFSnSZ jrG " S[ S\\D5      rH " S] S^\D5      rI So       SpS_ jjrJSqSrS` jjrK\9" 5         gs  snn f )s    )annotations)OptionalTYPE_CHECKINGcastN)options   )FontFace)FontManagerSUPPORTED_TTF_TYPESFontNotFoundErrorUnsupportedFont)FONT_SYNONYMS)FontMeasurements)	GlyphPathGlyphs)Drawing)	DXFEntity	Textstyleezdxffont_manager_cache.jsonFz.cacheAMGDTzamgdt___.ttfz	AMGDT.SHXCOMPLEXzcomplex_.ttfzCOMPLEX.SHXISOCPz	isocp.ttfz	ISOCP.SHXITALICzitalicc_.ttfz
ITALIC.SHXGOTHICGzgothicg_.ttfzGOTHICG.SHXGREEKCz
greekc.ttfz
GREEKC.SHXROMANSzromans__.ttfz
ROMANS.SHXSCRIPTSzscripts_.ttfzSCRIPTS.SHXSCRIPTCzscriptc_.ttfzsimplex_.ttfzsymath__.ttfzsymap___.ttfzsymeteo_.ttfztxt_____.ttf)zSCRIPTC.SHXSIMPLEXzSIMPLEX.SHXSYMATHz
SYMATH.SHXSYMAPz	SYMAP.SHXSYMETEOzSYMETEO.SHXTXTTXT.SHXzstandard.lff)r$   r%   SHXgZd;O?gZd;O?z
*monospacec                L    U R                  5       nU[        ;   a	  [        U   n U $ )zEMap .shx font names to .ttf file names. e.g. "TXT" -> "txt_____.ttf" )upper	SHX_FONTS)	font_name
font_uppers     C/var/www/html/env/lib/python3.13/site-packages/ezdxf/fonts/fonts.pymap_shx_to_ttfr-   T   s(     "JYj)	    c                
   U R                  5       n[        R                  US5      n[        R	                  U5      (       a  U$ UR                  S5      (       d  U S-   nOU SS S-   n[        R	                  U5      (       a  U$ U $ )zEMap .shx font names to .lff file names. e.g. "TXT" -> "standard.lff"  z.SHX.lffN)r(   	LFF_FONTSgetfont_managerhas_fontendswith)r*   r+   namelff_names       r,   map_shx_to_lffr:   ]   s{    "J==R(DT""v&&v%Sb>F*X&&r.   c                `    U R                  5       nUR                  S5      (       a  gSU;  a  gg)N.shxT.F)lowerr7   )r*   r8   s     r,   is_shx_font_namer?   l   s-    ??D}}V
$r.   c                H    [         R                  U R                  5       5      $ )zEMaps .ttf filenames to .shx font names. e.g. "txt_____.ttf" -> "TXT" )
TTF_TO_SHXr4   r>   )ttfs    r,   map_ttf_to_shxrC   u   s    >>#))+&&r.   c                 *    [        [        5       5        g)zBuilds or rebuilds the font manager cache. The font manager cache has a fixed
location in the cache directory of the users home directory "~/.cache/ezdxf" or the
directory specified by the environment variable "XDG_CACHE_HOME".
N)build_font_manager_cache_get_font_manager_path r.   r,   build_system_font_cacherH   z   s    
 356r.   c                ,    [         R                  U 5      $ )ziReturns the :class:`FontFace` definition for the given font filename
e.g. "LiberationSans-Regular.ttf".

)r5   get_font_face)r*   s    r,   find_font_facerK      s    
 %%i00r.   c                |    [        U [        5      (       d  [        S5      eU(       a  [        U 5      n [	        U 5      $ )a  Returns  the :class:`FontFace` definition for the given font filename
e.g. "LiberationSans-Regular.ttf".

This function translates a DXF font definition by the TTF font file name into a
:class:`FontFace` object. Returns the :class:`FontFace` of the default font when a
font is not available on the current system.

Args:
    font_name: raw font file name as stored in the
        :class:`~ezdxf.entities.Textstyle` entity
    map_shx: maps SHX font names to TTF replacement fonts,
        e.g. "TXT" -> "txt_____.ttf"

font_name has invalid type)
isinstancestr	TypeErrorr-   rK   )r*   map_shxs     r,   rJ   rJ      s5     i%%455"9-	)$$r.   c                   [        U5      S:X  a  U $ UR                  5       nU H  nUS:X  a+  [        U 5      n[        R	                  U5      (       a  Us  $ M4  US:X  aI  U R                  5       R                  S5      (       d  U S-  n [        R	                  U 5      (       a  U s  $ M  US:X  d  M  [        U 5      n[        R	                  U5      (       d  M  Us  $    U $ )zResolves a .shx font name, the argument `order` defines the resolve order:

- "t" = map .shx fonts to TrueType fonts (.ttf, .ttc, .otf)
- "s" = use shapefile fonts (.shx, .shp)
- "l" = map .shx fonts to LibreCAD fonts (.lff)

r   tsr<   l)lenr>   r-   r5   r6   r7   r:   )r*   ordertype_strr8   s       r,   resolve_shx_font_namerY      s     5zQKKMEs?!),D$$T** +_??$--f55V#	$$Y//   0_!),D$$T**  r.   c                    [        U [        5      (       d  [        S5      e[        U 5      (       a  [	        X5      n [        U 5      $ )a  Returns the :class:`FontFace` definition for the given font filename
e.g. "LiberationSans-Regular.ttf".

This function translates a DXF font definition by the TTF font file name into a
:class:`FontFace` object. Returns the :class:`FontFace` of the default font when a
font is not available on the current system.

The order argument defines the resolve order for .shx fonts:

- "t" = map .shx fonts to TrueType fonts (.ttf, .ttc, .otf)
- "s" = use shapefile fonts (.shx, .shp)
- "l" = map .shx fonts to LibreCAD fonts (.lff)

Args:
    font_name: raw font file name as stored in the
        :class:`~ezdxf.entities.Textstyle` entity
    order: resolving order

rM   )rN   rO   rP   r?   rY   rK   )r*   rW   s     r,   resolve_font_facer[      s=    ( i%%455	""));	)$$r.   c                    U(       a  [        U 5      n O$[        U 5      (       a  [        SS[        [        S9$ [        U SS9nUR                  $ )a*  Get :class:`FontMeasurements` for the given font filename
e.g. "LiberationSans-Regular.ttf".

Args:
    font_name: raw font file name as stored in the
        :class:`~ezdxf.entities.Textstyle` entity
    map_shx: maps SHX font names to TTF replacement fonts,
        e.g. "TXT" -> "txt_____.ttf"

r   r   baseline
cap_heightx_heightdescender_height)r_   )r-   r?   r   X_HEIGHT_FACTORDESCENDER_FACTORTrueTypeFontmeasurements)r*   rQ   fonts      r,   get_font_measurementsrg      sO     "9-		)	$	$$-	
 	
 	a0Dr.   z
sans-serifRegular     familystyleweightwidthitalicc                0    [         R                  XX#U5      $ )a  Returns a :class:`FontFace` that matches the given properties best. The search
is based the descriptive properties and not on comparing glyph shapes. Returns
``None`` if no font was found.

Args:
    family: font family name e.g. "sans-serif", "Liberation Sans"
    style: font style e.g. "Regular", "Italic", "Bold"
    weight: weight in the range from 1-1000 (usWeightClass)
    width: width in the range from 1-9 (usWidthClass)
    italic: ``True``, ``False`` or ``None`` to ignore this flag

)r5   find_best_matchrk   s        r,   rr   rr      s    ( ''vfMMr.   c                ,    [         R                  U 5      $ )zQReturns the true type font file name without parent directories e.g. "Arial.ttf".)r5   find_font_name)	font_faces    r,   find_font_file_namerv     s    &&y11r.   c                 H    [        5         [        R                  [        SS9  g)z[Reload all cache files. The cache files are loaded automatically at the import
of `ezdxf`.
T)reverseN)_load_font_managerr5   add_synonymsr   rG   r.   r,   loadr{     s      mT:r.   c                 J    [         R                  " S[        5      n U [        -  $ )NXDG_CACHE_HOME)r   xdg_pathCACHE_DIRECTORYFONT_MANAGER_CACHE_FILE)
cache_paths    r,   rF   rF     s!    !!"2ODJ///r.   c                    [        5       n U R                  5       (       a%   [        R                  U R	                  5       5        g [        U 5        g ! [
         a+  n[        R                  S[        U5       35         S nAN<S nAff = f)NError loading cache file: )
rF   existsr5   loads	read_textIOErrorloggerinforO   rE   )fm_pathes     r,   ry   ry     sm    $&G~~	?w0023 W%  	?KK4SVH=>>	?s   #A 
B!BBc                   Sq [        R                  5         U S-  nUR                  5       (       a%   [        R	                  UR                  5       5        g[        R                  [        U 5      /SS9  [        R                  5       n UR                  U5        g! [         a!  n[        S[        U5       35         SnANkSnAff = f! [         a!  n[        S[        U5       35         SnAgSnAff = f)zLoad font manger cache for system under test (sut).

Load the fonts included in the repository folder "./fonts" to guarantee the tests
have the same fonts available on all systems.

This function should be called from "conftest.py".

Tr   Nr   F)support_dirszError writing cache file: )SUT_FONT_MANAGER_CACHEr5   clearr   r   r   r   printrO   builddumps
write_text)repo_font_path
cache_filer   rT   s       r,   build_sut_font_manager_cacher   %  s     "";;J	9z3356 N+,5AA5a   	9.s1vh788	9  5*3q6(3445s/   #B 	C	 
C%CC	
C4C//C4c                p    U R                  5       (       d   U R                  SS9  g g ! [         a     g f = f)NT)parents)r   mkdirr   )paths    r,   make_cache_directoryr   @  s9    ;;==	JJtJ$   		s   ( 
55c                   [         R                  5         [         R                  5         [         R                  5       nU R                  n[        U5        UR                  5       (       d#  [        R                  S[        U5       S35        g  U R                  U5        g ! [         a,  n[        R                  S[        U5       S35         S nAg S nAff = f)Nz%Cannot create cache home directory: 'z\', cache files will not be saved.
See also issue https://github.com/mozman/ezdxf/issues/923.zError writing cache file: '')r5   r   r   r   parentr   r   r   warningrO   r   r   )r   rT   	cache_dirr   s       r,   rE   rE   H  s    AI#3C	N3C DX Y	
 	@ @4SVHA>??@s   B 
C)"CCc                  N    \ rS rSr\R
                  " 5       r\R
                  rSrg)FontRenderTypeiZ  rG   N)	__name__
__module____qualname____firstlineno__enumautoOUTLINESTROKE__static_attributes__rG   r.   r,   r   r   Z  s    iikG YYFr.   r   c                  v   \ rS rSr% Sr\R                  rSrS\	S'   SS jr
\R                  SS j5       r\R                   S       SS jj5       r\R                  SS	 j5       r\R                  SS
 j5       r\R                   S       SS jj5       r\R                   S       SS jj5       rSrg)AbstractFontib  zJThe `ezdxf` font abstraction for text measurement and text path rendering.	undefinedrO   r8   c                    Xl         g Nre   )selfre   s     r,   __init__AbstractFont.__init__h  s    (r.   c                    g)DReturns the text width in drawing units for the given `text` string.NrG   r   texts     r,   
text_widthAbstractFont.text_widthk       	r.   c                    g)^Returns the text width in drawing units, bypasses the stored `cap_height` and
`width_factor`.
NrG   r   r   r_   width_factors       r,   text_width_exAbstractFont.text_width_exp  s     	r.   c                    g)z=Returns the width of a "space" character a.k.a. word spacing.NrG   r   s    r,   space_widthAbstractFont.space_widthy  r   r.   c                    g),Returns the 2D text path for the given text.NrG   r   s     r,   	text_pathAbstractFont.text_path~  s     	r.   c                    g)aReturns the 2D text path for the given text, bypasses the stored `cap_height`
and `width_factor`.NrG   r   s       r,   text_path_exAbstractFont.text_path_ex       	r.   c                    g)iReturns a list of 2D glyph paths for the given text, bypasses the stored
`cap_height` and `width_factor`.NrG   r   s       r,   text_glyph_pathsAbstractFont.text_glyph_paths  r   r.   r   N)re   r   r   rO   returnfloat      ?r   rO   r_   r   r   r   r   r   r   r   r   rO   r   r   r   rO   r_   r   r   r   r   r   r   rO   r_   r   r   r   r   zlist[GlyphPath])r   r   r   r   __doc__r   r   font_render_typer8   __annotations__r   abcabstractmethodr   r   r   r   r   r   r   rG   r.   r,   r   r   b  s%   T%,,D#) 	  	BE%*:?	  	  	  	BE%*:?	  	BE%*:?	 r.   r   c                     ^  \ rS rSrSr\R                  r\r	SS\
\4         SU 4S jjjrSS jr S       SS jjrSS jr S       SS	 jjr S       SS
 jjrSS jrSrU =r$ )MonospaceFonti  a]  Represents a monospaced font where each letter has the same cap- and descender
height and the same width. The given cap height and width factor are the default
values for measurements and rendering. The extended methods can override these
default values.

This font exists only for generic text measurement in tests and does not render any
glyphs!

r   r   c           	        > [         TU ]  [        UUX-  X-  S95        [        U5      U l        U R
                  R                  U R                  -  U l        g )Nr]   )superr   r   abs_width_factorre   r_   _space_width)r   r_   r   r^   descender_factorx_height_factor	__class__s         r,   r   MonospaceFont.__init__  sZ     	!%#5!+!>		
 %($5 --884;M;MMr.   c                b    U R                  XR                  R                  U R                  5      $ )z=Returns the text width in drawing units for the given `text`.)r   re   r_   r   r   s     r,   r   MonospaceFont.text_width  s,    !!##..0B0B
 	
r.   c                $    [        U5      U-  U-  $ )r   )rV   r   s       r,   r   MonospaceFont.text_width_ex  s     4y:%44r.   c                b    U R                  XR                  R                  U R                  5      $ )zOReturns the rectangle text width x cap height as :class:`NumpyPath2d` instance.)r   re   r_   r   r   s     r,   r   MonospaceFont.text_path  s'      '8'8'C'CTEWEWXXr.   c                    SSK Jn  U R                  XU5      nU" S5      nUR                  US45        UR                  XR45        UR                  SU45        UR	                  5         [        U5      $ )zReturns the rectangle text width x cap height as  :class:`NumpyPath2d`
instance, bypasses the stored `cap_height` and `width_factor`.
r   )Path)r   r   )
ezdxf.pathr   r   line_tocloser   )r   r   r_   r   r   r   ps          r,   r   MonospaceFont.text_path_ex  sd     	$'',G
L			:q/"			:*+			1j/"		|r.   c                (    U R                  XU5      /$ )zHReturns the same rectangle as the method :meth:`text_path_ex` in a list.)r   r   s       r,   r   MonospaceFont.text_glyph_paths  s     !!$LABBr.   c                    U R                   $ z$Returns the width of a "space" char.r   r   s    r,   r   MonospaceFont.space_width         r.   )r   r   )
r_   r   r   r   r^   r   r   r   r   r   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   	MONOSPACEr8   rc   rb   r   r   r   r   r   r   r   r   __classcell__r   s   @r,   r   r     s    &,,D
 ""2!0NN N 	N
  N N N&
 CF55%*5:?5	5Y
 CF%*:?	" CFCC%*C:?C	C! !r.   r   c                     ^  \ rS rSr% Sr\" 5       rS\S'   SSU 4S jjjr\	R                  SS j5       rSS jr S       SS jjrSS	 jr S       SS
 jjr S       SS jjrSS jrSrU =r$ )_CachedFonti  z#Abstract font with caching support.zdict[str, Glyphs]_glyph_cachesc                H  > Xl         U R                  U5      nX@l        [        U5      U l        [        U5      U l        UR                  U R                  5      n[        TU ]!  UR                  R                  U5      5        U R                  R                  U-  U-  U l        g r   )r8   create_cacheglyph_cacher   r_   r   get_scaling_factorr   r   font_measurementsscaler   r   )r   r*   r_   r   cachescale_factorr   s         r,   r   _CachedFont.__init__  s    	!!), 
+!,/#66tG0066|DE((<7,F 	r.   c                    g r   rG   )r   r*   s     r,   r  _CachedFont.create_cache  s    r.   c                N    U R                  XR                  U R                  5      $ )r   )r   r_   r   r   s     r,   r   _CachedFont.text_width  s    !!$9J9JKKr.   c                f    UR                  5       (       d  gU R                  R                  XU5      $ )r   r   )stripr	  get_text_lengthr   s       r,   r   _CachedFont.text_width_ex  s+     zz||//,OOr.   c                N    U R                  XR                  U R                  5      $ )r   )r   r_   r   r   s     r,   r   _CachedFont.text_path  s!       8I8IJJr.   c                :    U R                   R                  XU5      $ )r   )r	  get_text_pathr   s       r,   r   _CachedFont.text_path_ex
  s    
 --dMMr.   c                :    U R                   R                  XU5      $ )r   )r	  get_text_glyph_pathsr   s       r,   r   _CachedFont.text_glyph_paths  s    
 44T|TTr.   c                    U R                   $ r   r   r   s    r,   r   _CachedFont.space_width  r   r.   )r   r_   r	  r8   r   r   )r*   rO   r_   r   r   r   r*   rO   r   r   r   r   r   r   r   r   )r   r   r   r   r   dictr  r   r   r   r   r  r   r   r   r   r   r   r   r  r  s   @r,   r  r    s    -'+vM$-

 

 	 L
 CFPP%*P:?P	PK CFNN%*N:?N	N CFUU%*U:?U	U! !r.   r  c                  :    \ rS rSrSr\R                  rSS jrSr	g)rd   i  a   Represents a TrueType font. Font measurement and glyph rendering is done by the
`fontTools` package. The given cap height and width factor are the default values
for measurements and glyph rendering. The extended methods can override these
default values.
c                   SSK Jn  [        R                  " U5      R                  R                  5       n U R                  U   $ ! [         a     Of = f [        R                  U5      n U" U5      nOo! [         a    [        ef = f! [         aN    [        R                  5       n[        R                  SU SU S35        U" [        R                  U5      5      n Of = fXPR                  U'   U$ )Nr   TTFontRendererzreplacing unsupported font 'z' by 'r   )ttfontsr'  pathlibr   r8   r>   r  KeyErrorr5   get_ttf_font	Exceptionr   fallback_font_namer   r   )r   rB   r'  keytt_fontr  r-  s          r,   r  TrueTypeFont.create_cache&  s    +ll3$$**,	%%c** 				R"//4G&&w/ &%%& 	R!-!@!@!BKK6se6BTAUUVWX"<#<#<=O#PQE	R #(3s6   A 
AAB	 ,A5 5BB	 	AC! C!rG   NrB   rO   r   r   )
r   r   r   r   r   r   r   r   r  r   rG   r.   r,   rd   rd     s     &--r.   rd   c                  6    \ rS rSr\R
                  rSS jrSrg)_UnmanagedTrueTypeFonti<  c                    SSK Jn  SSKJn  UR	                  5       n U R
                  U   $ ! [         a     Of = fU" U" USS95      nXPR
                  U'   U$ )Nr   r&  r   )TTFont)
fontNumber)r(  r'  fontTools.ttLibr5  r>   r  r*  )r   rB   r'  r5  r.  r  s         r,   r  #_UnmanagedTrueTypeFont.create_cache?  s_    +*iik	%%c** 		vca89"'3s   - 
::rG   Nr1  )	r   r   r   r   r   r   r   r  r   rG   r.   r,   r3  r3  <  s    %--r.   r3  c                ,    [        [        U 5      U5      $ )a  This function bypasses the FontManager and loads the TrueType font straight from
the file system, requires the absolute font file path e.g. "C:/Windows/Fonts/Arial.ttf".

.. warning::

    Expert feature, use with care: no fallback font and no error handling.

)r3  rO   )	font_pathr_   s     r,   sideload_ttfr;  M  s     "#i.*==r.   c                  :    \ rS rSrSr\R                  rSS jrSr	g)ShapeFileFontiZ  a  Represents a shapefile font (.shx, .shp). Font measurement and glyph rendering is
done by the ezdxf.fonts.shapefile module. The given cap height and width factor are
the default values for measurements and glyph rendering. The extended methods can
override these default values.

c                    UR                  5       n U R                  U   $ ! [         a     Of = f[        R	                  U5      nX0R                  U'   U$ r   )r>   r  r*  r5   get_shapefile_glyph_cacher   r*   r.  r	  s       r,   r  ShapeFileFont.create_cached  sZ    oo	%%c** 		"<<YG"-3   ! 
..rG   Nr"  
r   r   r   r   r   r   r   r   r  r   rG   r.   r,   r=  r=  Z       &,,r.   r=  c                  :    \ rS rSrSr\R                  rSS jrSr	g)LibreCadFontio  a  Represents a LibreCAD font (.shx, .shp). Font measurement and glyph rendering is
done by the ezdxf.fonts.lff module. The given cap height and width factor are the
default values for measurements and glyph rendering. The extended methods can
override these default values.

c                    UR                  5       n U R                  U   $ ! [         a     Of = f[        R	                  U5      nX0R                  U'   U$ r   )r>   r  r*  r5   get_lff_glyph_cacher@  s       r,   r  LibreCadFont.create_cachey  sZ    oo	%%c** 		"66yA"-3rB  rG   Nr"  rC  rG   r.   r,   rF  rF  o  rD  r.   rF  c                f   U [         :X  a  [        X5      $ [        R                  " U 5      R                  R                  5       n[        X5      nU[        ;   a   [        XU5      $ US:X  d  US:X  a   [        XU5      $ US:X  a   [!        XU5      $ US:X  a/  [        R#                  U SSS9nUb  [%        UR&                  X5      $ O,[        R                  SU  35        [        R                  5       n  [        XU5      $ ! [         a-  n[        R                  S[        U5       35        Us SnA$ SnAff = f! [         a     NS[         a    [        R                  5       n  Nrf = f! [         a     Nf = f! [         a-  n[        R                  S[        U5       35        Us SnA$ SnAff = f)	uj  Returns a font abstraction based on class :class:`AbstractFont`.

Supported font types:

- .ttf, .ttc and .otf - TrueType fonts
- .shx, .shp - Autodesk® shapefile fonts
- .lff - LibreCAD font format

The special name "\*monospace" returns the fallback font :class:`MonospaceFont` for
testing and basic measurements.

.. note:: The font definition files are not included in `ezdxf`.

Args:
    font_name: font file name as stored in the :class:`~ezdxf.entities.Textstyle`
        entity e.g. "OpenSans-Regular.ttf"
    cap_height: desired cap height in drawing units.
    width_factor: horizontal text stretch factor

zno default font found: Nr<   z.shpr1   r0   )rl   rm   rp   zunsupported font-name suffix: )r  r   r)  r   suffixr>   r   rd   r   r   r   rO   r=  r   r5   r-  rF  rr   	make_fontfilename)r*   r_   r   extlast_resortr   ru   s          r,   rL  rL    s   . IZ66
,,y
!
(
(
.
.
0C
9K
!!		|DD 
#-	: EE 
		|DD 
 00F4 1 
	  Y//JJ ! 	7	{CD 335	I<@@9 ! 	NN4SVH=>	 ! 	 	:$779I	: ! 		  0Q9:sf   D  3D: E) 4E9  
D7
"D2,D72D7:
E&E&%E&)
E65E69
F0"F+%F0+F0c                   U R                   (       a  Uc  U R                   nUc
  [        5       $ SnU R                  R                  S5      (       a  U R                  R                  n[        5       nU(       a  [        SUR                  R                  U5      5      nUR                  5       u  pVnU(       a"  U(       a  SOSnU(       a  SOSn	[        XXU	S9nU$ UR                  R                  n
U
(       a  [        U
5      nU$ )	a  Returns the :class:`FontFace` defined by the associated text style.
Returns the default font face if the `entity` does not have or support
the DXF attribute "style". Supports the extended font information stored in
:class:`~ezdxf.entities.Textstyle` table entries.

Pass a DXF document as argument `doc` to resolve text styles for virtual
entities which are not assigned to a DXF document. The argument `doc`
always overrides the DXF document to which the `entity` is assigned to.

r0   rm   r   Italicrh   i  ri   )rl   rm   rn   )docr	   dxfis_supportedrm   r   stylesr4   get_extended_font_datarf   rJ   )entityrR  
style_nameru   rm   rl   rp   bold
text_styletext_weightrB   s              r,   get_entity_font_facer\    s     zzckjj
{zJ zzw''ZZ%%

I[#**.."<=$;;=%+J!%#3K UI
  ))..C)#.	r.   )r*   rO   r   rO   )r*   rO   r   bool)rB   rO   r   zOptional[str])r   None)r*   rO   r   r	   )T)r*   rO   rW   rO   r   rO   )tsl)r*   rO   r   r   )rl   rO   rm   rO   rn   intro   r`  rp   zOptional[bool]r   zOptional[FontFace])ru   r	   r   rO   )r   pathlib.Pathr   r^  )r   ra  r   r^  )r:  zstr | os.PathLiker   r   r   )r*   rO   r_   r   r   r   r   r   r   )rW  r   rR  zOptional[Drawing]r   r	   )L
__future__r   typingr   r   r   r   r   loggingosr)  r   r   ru   r	   r5   r
   r   r   r   font_synonymsr   r  r   glyphsr   r   ezdxf.documentr   ezdxf.entitiesr   r   	getLoggerr   r   r   r   r)   r3   itemsr7   rA   rc   rb   r  r-   r:   r?   rC   rH   rK   rJ   rY   r[   rg   rr   rv   r{   rF   ry   r   r   rE   Enumr   r   r   ABCr  rd   r3  r;  r=  rF  rL  r\  )kvs   00r,   <module>rp     s   # 0 0 
   	     ) / %&3			7	#3  }' ^' ' ~' >' ['  !'" n#'$ .%'& ~''( >)'* l+', ,-'. n/'0 .1'2 ~3'4 >5'6 ~7'8 "! !M'	R 	  )0F0tqAJJu4Edad0F
 	'
71%,8%64 "NN N 	N
 N N N.2
;0
&56@$TYY / /dK!L K!\8!, 8!v; >[ "
>K *; , >A== %=5:==@"J w Gs    H H