Files
xhsautopublisher/config.py
2025-09-05 17:20:14 +08:00

131 lines
3.6 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#########################################################
## @file : config.py
## @desc : manage the config params
## @create : 2025/6/22
## @author : Chengandoubao AI
## @email : douboer@gmail.com
#########################################################
#定义内容字体
fonts_path = {
'title': 'fonts/LXGWWenKai-Medium.TTF',
'subtitle': 'fonts/LXGWWenKai-Medium.TTF',
'body': 'fonts/LXGWWenKai-Light.TTF',
'signature': 'fonts/LXGWWenKai-Light.TTF',
'table': 'fonts/LXGWWenKai-Light.TTF'
}
#定义底图模版
templates = {
'minimal': {
'background': 'backgrounds/IMG_5784.JPG',
'padding': 150
},
'modern': {
'background': 'backgrounds/IMG_5789.JPG',
'padding': 60
},
'vintage': {
'background': 'backgrounds/IMG_5793.JPG',
'padding': 70
}
}
#--------------------------------
#top_spacing
#____________________
#____________________title
#bottom_spacing
#____________________
#____________________subtitle
#bottom_spacing
#____________________
#____________________content paragraph
#paragraph_spacing
#____________________
#____________________content paragraph
#
#
#____________________
#____________________@sign
#offset
#--------------------------------
#定义各部分内容样式
styles = {
'bottom_offset': 100, #定义新段落距离模版底部的最小距离
'top_offset': 200, #定义内容分页,内容的起始距离模版顶部的距离
'paragraph_spacing': 50, #定义段间距
'title': {
'size': 100,
'letter_spacing': 0,
'color': (30, 30, 30),
'line_spacing': 10,
'top_spacing': 70,
'bottom_spacing': 70
},
'subtitle': {
'size': 50,
'letter_spacing': 0,
'color': (60, 60, 60),
'line_spacing': 10,
'bottom_spacing': 70
},
'body': {
'size': 45, # 增大字体适应更大尺寸
'line_spacing': 25,
'letter_spacing': 5,
'color': (100, 100, 100),
'bottom_spacing': 100
},
# 表格样式(核心优化部分)
#'table': {
# 'header': {
# 'font_size': 24,
# 'font_color': 'black',
# 'background_color': '#E6E6E6',
# 'height': 60, # 增加行高
# 'font_family': 'LXGWWenKai-Medium, SimHei, Arial' # 支持中英文字体
# },
# 'cells': {
# 'font_size': 22,
# 'font_color': 'black',
# 'background_color': 'white',
# 'height': 50, # 增加行高
# 'line_color': 'black',
# 'font_family': 'LXGWWenKai-Light, SimHei, Arial', # 支持中英文字体
# 'align': 'left' # 左对齐
# },
# 'layout': {
# 'width': 1200,
# 'height': 800,
# 'margin': {'t': 50, 'b': 50, 'l': 50, 'r': 50},
# 'title': {'text': '项目评估表格', 'font': {'size': 30, 'family': 'LXGWWenKai-Medium, SimHei, Arial'}},
# 'showlegend': False
# },
# 'image': {
# 'format': 'png',
## 'width': 1200,
# 'height': 800,
# 'scale': 2
# },
# 'border': { # 新增边框配置
# 'width': 1,
# 'color': 'black'
# },
# 'header_alignment': 'center', # 表头居中
# 'cell_alignment': 'left' # 单元格左对齐
#},
'signature': {
'size': 36,
'letter_spacing': 2,
'color': (80, 80, 80),
'position': 'right', # 水平位置left, center, right
'vertical_position': 'bottom', # 垂直位置bottom, flow
'offset': 50 # 距离底部的偏移量
}
}