@@ -719,11 +719,11 @@ def __init__(self, filename, metadata=None):
719719
720720 self .infoDict = _create_pdf_info_dict ('pdf' , metadata or {})
721721
722- self .fontNames = {} # maps filenames to internal font names
723722 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
725725 # differently encoded Type-1 fonts may share the same descriptor
726- self .type1Descriptors = {}
726+ self ._type1Descriptors = {}
727727 self ._character_tracker = _backend_pdf_ps .CharacterTracker ()
728728
729729 self .alphaStates = {} # maps alpha values to graphics state objects
@@ -765,6 +765,11 @@ def __init__(self, filename, metadata=None):
765765 'ProcSet' : procsets }
766766 self .writeObject (self .resourceObject , resources )
767767
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+
768773 def newPage (self , width , height ):
769774 self .endStream ()
770775
@@ -894,7 +899,7 @@ def _write_annotations(self):
894899 def fontName (self , fontprop ):
895900 """
896901 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
898903 as the filename of the font.
899904 """
900905
@@ -908,12 +913,12 @@ def fontName(self, fontprop):
908913 filenames = _fontManager ._find_fonts_by_props (fontprop )
909914 first_Fx = None
910915 for fname in filenames :
911- Fx = self .fontNames .get (fname )
916+ Fx = self ._fontNames .get (fname )
912917 if not first_Fx :
913918 first_Fx = Fx
914919 if Fx is None :
915920 Fx = next (self ._internal_font_seq )
916- self .fontNames [fname ] = Fx
921+ self ._fontNames [fname ] = Fx
917922 _log .debug ('Assigning font %s = %r' , Fx , fname )
918923 if not first_Fx :
919924 first_Fx = Fx
@@ -925,11 +930,11 @@ def fontName(self, fontprop):
925930 def dviFontName (self , dvifont ):
926931 """
927932 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.
930935 """
931936
932- dvi_info = self .dviFontInfo .get (dvifont .texname )
937+ dvi_info = self ._dviFontInfo .get (dvifont .texname )
933938 if dvi_info is not None :
934939 return dvi_info .pdfname
935940
@@ -943,7 +948,7 @@ def dviFontName(self, dvifont):
943948
944949 pdfname = next (self ._internal_font_seq )
945950 _log .debug ('Assigning font %s = %s (dvi)' , pdfname , dvifont .texname )
946- self .dviFontInfo [dvifont .texname ] = types .SimpleNamespace (
951+ self ._dviFontInfo [dvifont .texname ] = types .SimpleNamespace (
947952 dvifont = dvifont ,
948953 pdfname = pdfname ,
949954 fontfile = psfont .filename ,
@@ -954,12 +959,12 @@ def dviFontName(self, dvifont):
954959
955960 def writeFonts (self ):
956961 fonts = {}
957- for dviname , info in sorted (self .dviFontInfo .items ()):
962+ for dviname , info in sorted (self ._dviFontInfo .items ()):
958963 Fx = info .pdfname
959964 _log .debug ('Embedding Type-1 font %s from dvi.' , dviname )
960965 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 ]
963968 _log .debug ('Embedding font %s.' , filename )
964969 if filename .endswith ('.afm' ):
965970 # from pdf.use14corefonts
@@ -1039,10 +1044,10 @@ def _embedTeXFont(self, fontinfo):
10391044 # existing descriptor for this font.
10401045 effects = (fontinfo .effects .get ('slant' , 0.0 ),
10411046 fontinfo .effects .get ('extend' , 1.0 ))
1042- fontdesc = self .type1Descriptors .get ((fontinfo .fontfile , effects ))
1047+ fontdesc = self ._type1Descriptors .get ((fontinfo .fontfile , effects ))
10431048 if fontdesc is None :
10441049 fontdesc = self .createType1Descriptor (t1font , fontinfo .fontfile )
1045- self .type1Descriptors [(fontinfo .fontfile , effects )] = fontdesc
1050+ self ._type1Descriptors [(fontinfo .fontfile , effects )] = fontdesc
10461051 fontdict ['FontDescriptor' ] = fontdesc
10471052
10481053 self .writeObject (fontdictObject , fontdict )
0 commit comments