@@ -719,11 +719,11 @@ def __init__(self, filename, metadata=None):
719
719
720
720
self .infoDict = _create_pdf_info_dict ('pdf' , metadata or {})
721
721
722
- self .fontNames = {} # maps filenames to internal font names
723
722
self ._internal_font_seq = (Name (f'F{ i } ' ) for i in itertools .count (1 ))
724
- self .dviFontInfo = {} # maps dvi font names to embedding information
723
+ self ._fontNames = {} # maps filenames to internal font names
724
+ self ._dviFontInfo = {} # maps dvi font names to embedding information
725
725
# differently encoded Type-1 fonts may share the same descriptor
726
- self .type1Descriptors = {}
726
+ self ._type1Descriptors = {}
727
727
self ._character_tracker = _backend_pdf_ps .CharacterTracker ()
728
728
729
729
self .alphaStates = {} # maps alpha values to graphics state objects
@@ -765,6 +765,11 @@ def __init__(self, filename, metadata=None):
765
765
'ProcSet' : procsets }
766
766
self .writeObject (self .resourceObject , resources )
767
767
768
+ fontNames = _api .deprecated ("3.11" )(property (lambda self : self ._fontNames ))
769
+ dviFontNames = _api .deprecated ("3.11" )(property (lambda self : self ._dviFontNames ))
770
+ type1Descriptors = _api .deprecated ("3.11" )(
771
+ property (lambda self : self ._type1Descriptors ))
772
+
768
773
def newPage (self , width , height ):
769
774
self .endStream ()
770
775
@@ -894,7 +899,7 @@ def _write_annotations(self):
894
899
def fontName (self , fontprop ):
895
900
"""
896
901
Select a font based on fontprop and return a name suitable for
897
- Op.selectfont. If fontprop is a string, it will be interpreted
902
+ `` Op.selectfont`` . If fontprop is a string, it will be interpreted
898
903
as the filename of the font.
899
904
"""
900
905
@@ -908,12 +913,12 @@ def fontName(self, fontprop):
908
913
filenames = _fontManager ._find_fonts_by_props (fontprop )
909
914
first_Fx = None
910
915
for fname in filenames :
911
- Fx = self .fontNames .get (fname )
916
+ Fx = self ._fontNames .get (fname )
912
917
if not first_Fx :
913
918
first_Fx = Fx
914
919
if Fx is None :
915
920
Fx = next (self ._internal_font_seq )
916
- self .fontNames [fname ] = Fx
921
+ self ._fontNames [fname ] = Fx
917
922
_log .debug ('Assigning font %s = %r' , Fx , fname )
918
923
if not first_Fx :
919
924
first_Fx = Fx
@@ -925,11 +930,11 @@ def fontName(self, fontprop):
925
930
def dviFontName (self , dvifont ):
926
931
"""
927
932
Given a dvi font object, return a name suitable for Op.selectfont.
928
- This registers the font information in ``self.dviFontInfo`` if not yet
929
- registered.
933
+ This registers the font information internally ( in ``_dviFontInfo``) if
934
+ not yet registered.
930
935
"""
931
936
932
- dvi_info = self .dviFontInfo .get (dvifont .texname )
937
+ dvi_info = self ._dviFontInfo .get (dvifont .texname )
933
938
if dvi_info is not None :
934
939
return dvi_info .pdfname
935
940
@@ -943,7 +948,7 @@ def dviFontName(self, dvifont):
943
948
944
949
pdfname = next (self ._internal_font_seq )
945
950
_log .debug ('Assigning font %s = %s (dvi)' , pdfname , dvifont .texname )
946
- self .dviFontInfo [dvifont .texname ] = types .SimpleNamespace (
951
+ self ._dviFontInfo [dvifont .texname ] = types .SimpleNamespace (
947
952
dvifont = dvifont ,
948
953
pdfname = pdfname ,
949
954
fontfile = psfont .filename ,
@@ -954,12 +959,12 @@ def dviFontName(self, dvifont):
954
959
955
960
def writeFonts (self ):
956
961
fonts = {}
957
- for dviname , info in sorted (self .dviFontInfo .items ()):
962
+ for dviname , info in sorted (self ._dviFontInfo .items ()):
958
963
Fx = info .pdfname
959
964
_log .debug ('Embedding Type-1 font %s from dvi.' , dviname )
960
965
fonts [Fx ] = self ._embedTeXFont (info )
961
- for filename in sorted (self .fontNames ):
962
- Fx = self .fontNames [filename ]
966
+ for filename in sorted (self ._fontNames ):
967
+ Fx = self ._fontNames [filename ]
963
968
_log .debug ('Embedding font %s.' , filename )
964
969
if filename .endswith ('.afm' ):
965
970
# from pdf.use14corefonts
@@ -1039,10 +1044,10 @@ def _embedTeXFont(self, fontinfo):
1039
1044
# existing descriptor for this font.
1040
1045
effects = (fontinfo .effects .get ('slant' , 0.0 ),
1041
1046
fontinfo .effects .get ('extend' , 1.0 ))
1042
- fontdesc = self .type1Descriptors .get ((fontinfo .fontfile , effects ))
1047
+ fontdesc = self ._type1Descriptors .get ((fontinfo .fontfile , effects ))
1043
1048
if fontdesc is None :
1044
1049
fontdesc = self .createType1Descriptor (t1font , fontinfo .fontfile )
1045
- self .type1Descriptors [(fontinfo .fontfile , effects )] = fontdesc
1050
+ self ._type1Descriptors [(fontinfo .fontfile , effects )] = fontdesc
1046
1051
fontdict ['FontDescriptor' ] = fontdesc
1047
1052
1048
1053
self .writeObject (fontdictObject , fontdict )
0 commit comments