Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
zhougaofeng
magic_pdf
Commits
caadad10
Commit
caadad10
authored
Nov 13, 2024
by
zhougaofeng
Browse files
Update font_tools.py
parent
ceae1d62
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
magic_pdf/tools/font_tools.py
magic_pdf/tools/font_tools.py
+2
-2
No files found.
magic_pdf/tools/font_tools.py
View file @
caadad10
...
@@ -59,7 +59,7 @@ FONTS_ttf = [{'宋体':'simsun.ttc'},{'SimSun':'simsun.ttc'},{'KaiTi':'simkai.tt
...
@@ -59,7 +59,7 @@ FONTS_ttf = [{'宋体':'simsun.ttc'},{'SimSun':'simsun.ttc'},{'KaiTi':'simkai.tt
{
'STKAITI'
:
'STKAITI.TTF'
},{
'hei'
:
'simhei.ttf'
},{
'STXihei'
:
'simhei.ttf'
},{
'黑体'
:
'simhei.ttf'
},
{
'STKAITI'
:
'STKAITI.TTF'
},{
'hei'
:
'simhei.ttf'
},{
'STXihei'
:
'simhei.ttf'
},{
'黑体'
:
'simhei.ttf'
},
{
'华文细黑'
:
'STXIHEI.TTF'
},{
'SimHei'
:
'simhei.ttf'
},{
'Courier New'
:
'/usr/share/fonts/truetype/msttcorefonts/cour.ttf'
}]
{
'华文细黑'
:
'STXIHEI.TTF'
},{
'SimHei'
:
'simhei.ttf'
},{
'Courier New'
:
'/usr/share/fonts/truetype/msttcorefonts/cour.ttf'
}]
path_prefix
=
"/usr/
local/
share/fonts/zit/"
path_prefix
=
"/usr/share/fonts/
my_fonts/
zit
i
/"
# 批量注册字体
# 批量注册字体
for
font
in
FONTS_ttf
:
for
font
in
FONTS_ttf
:
...
@@ -71,7 +71,7 @@ for font in FONTS_ttf:
...
@@ -71,7 +71,7 @@ for font in FONTS_ttf:
font_path
=
os
.
path
.
join
(
path_prefix
,
file_name
)
font_path
=
os
.
path
.
join
(
path_prefix
,
file_name
)
pdfmetrics
.
registerFont
(
TTFont
(
font_name
,
font_path
))
pdfmetrics
.
registerFont
(
TTFont
(
font_name
,
font_path
))
except
Exception
as
e
:
except
Exception
as
e
:
print
(
f
"无法注册字体
{
font_name
}
:
{
e
}
"
)
logger
.
error
(
f
"无法注册字体
{
font_name
}
:
{
e
}
"
)
class
FontTool
(
object
):
class
FontTool
(
object
):
FONTS
=
FONTS
FONTS
=
FONTS
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment