Browse Source

fix vflag

Byaidu 1 year ago
parent
commit
29df2ce82d
3 changed files with 4 additions and 4 deletions
  1. 1 1
      pdf2zh/__init__.py
  2. 1 1
      pdf2zh/converter.py
  3. 2 2
      pdf2zh/pdfinterp.py

+ 1 - 1
pdf2zh/__init__.py

@@ -1,2 +1,2 @@
-__version__ = "1.5.1"
+__version__ = "1.5.2"
 __author__ = "Byaidu"

+ 1 - 1
pdf2zh/converter.py

@@ -412,7 +412,7 @@ class TextConverter(PDFConverter[AnyIO]):
                     if re.match(self.vfont,font):
                         return True
                 else:
-                    if re.match(r'(CM[^R].*|MS.*|XY.*|MT.*|BL.*|RM.*|EU.*|LINE.*|rsfs.*|txsy.*|.*0700|.*0500|.*Mono|.*Ital|.*Sym|.*math)',font):
+                    if re.match(r'(CM[^R]|MS|XY|MT|BL|RM|EU|LA|LINE|TeX-|rsfs|txsy|wasy|.*Mono|.*Code|.*Ital|.*Sym)',font):
                         return True
                 if self.vchar:
                     if re.match(self.vchar,char):

+ 2 - 2
pdf2zh/pdfinterp.py

@@ -968,10 +968,10 @@ class PDFPageInterpreter:
                 [xobj],
                 ctm=ctm,
             )
-            ctm_inv=np.linalg.inv(np.array(ctm[:4]).reshape(2,2))
-            self.device.fontmap=interpreter.fontmap # hack
             try: # 有的时候 form 字体加不上这里会烂掉
+                self.device.fontmap=interpreter.fontmap # hack
                 ops_new=self.device.end_figure(xobjid)
+                ctm_inv=np.linalg.inv(np.array(ctm[:4]).reshape(2,2))
                 pos_inv=-np.mat(ctm[4:])*ctm_inv
                 a,b,c,d=ctm_inv.reshape(4).tolist()
                 e,f=pos_inv.tolist()[0]