mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Add option to disable font size rescaling
This commit is contained in:
parent
b9e07c7e7b
commit
2ac2aed136
@ -107,7 +107,7 @@ def add_pipeline_options(parser, plumber):
|
|||||||
'LOOK AND FEEL' : (
|
'LOOK AND FEEL' : (
|
||||||
_('Options to control the look and feel of the output'),
|
_('Options to control the look and feel of the output'),
|
||||||
[
|
[
|
||||||
'base_font_size',
|
'base_font_size', 'disable_font_rescaling',
|
||||||
'font_size_mapping',
|
'font_size_mapping',
|
||||||
'line_height',
|
'line_height',
|
||||||
'linearize_tables',
|
'linearize_tables',
|
||||||
|
@ -117,6 +117,13 @@ OptionRecommendation(name='font_size_mapping',
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
|
OptionRecommendation(name='disable_font_rescaling',
|
||||||
|
recommended_value=False, level=OptionRecommendation.LOW,
|
||||||
|
help=_('Disable all rescaling of font sizes.'
|
||||||
|
)
|
||||||
|
),
|
||||||
|
|
||||||
|
|
||||||
OptionRecommendation(name='line_height',
|
OptionRecommendation(name='line_height',
|
||||||
recommended_value=0, level=OptionRecommendation.LOW,
|
recommended_value=0, level=OptionRecommendation.LOW,
|
||||||
help=_('The line height in pts. Controls spacing between consecutive '
|
help=_('The line height in pts. Controls spacing between consecutive '
|
||||||
|
@ -202,7 +202,8 @@ class CSSFlattener(object):
|
|||||||
if 'bgcolor' in node.attrib:
|
if 'bgcolor' in node.attrib:
|
||||||
cssdict['background-color'] = node.attrib['bgcolor']
|
cssdict['background-color'] = node.attrib['bgcolor']
|
||||||
del node.attrib['bgcolor']
|
del node.attrib['bgcolor']
|
||||||
if 'font-size' in cssdict or tag == 'body':
|
if not self.context.disable_font_rescaling and \
|
||||||
|
'font-size' in cssdict or tag == 'body':
|
||||||
fsize = self.fmap[style['font-size']]
|
fsize = self.fmap[style['font-size']]
|
||||||
cssdict['font-size'] = "%0.5fem" % (fsize / psize)
|
cssdict['font-size'] = "%0.5fem" % (fsize / psize)
|
||||||
psize = fsize
|
psize = fsize
|
||||||
|
@ -21,8 +21,11 @@ class LookAndFeelWidget(Widget, Ui_Form):
|
|||||||
['dont_justify', 'extra_css', 'base_font_size',
|
['dont_justify', 'extra_css', 'base_font_size',
|
||||||
'font_size_mapping', 'insert_metadata', 'line_height',
|
'font_size_mapping', 'insert_metadata', 'line_height',
|
||||||
'linearize_tables', 'remove_first_image',
|
'linearize_tables', 'remove_first_image',
|
||||||
|
'disable_font_rescaling',
|
||||||
'remove_paragraph_spacing', 'input_encoding']
|
'remove_paragraph_spacing', 'input_encoding']
|
||||||
)
|
)
|
||||||
self.db, self.book_id = db, book_id
|
self.db, self.book_id = db, book_id
|
||||||
self.initialize_options(get_option, get_help, db, book_id)
|
self.initialize_options(get_option, get_help, db, book_id)
|
||||||
|
self.opt_disable_font_rescaling.toggle()
|
||||||
|
self.opt_disable_font_rescaling.toggle()
|
||||||
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<ui version="4.0" >
|
||||||
<ui version="4.0">
|
|
||||||
<class>Form</class>
|
<class>Form</class>
|
||||||
<widget class="QWidget" name="Form">
|
<widget class="QWidget" name="Form" >
|
||||||
<property name="geometry">
|
<property name="geometry" >
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
@ -10,135 +9,142 @@
|
|||||||
<height>500</height>
|
<height>500</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle" >
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="gridLayout_6">
|
<layout class="QGridLayout" name="gridLayout_6" >
|
||||||
<item row="0" column="0" colspan="2">
|
<item row="1" column="0" colspan="2" >
|
||||||
<widget class="QLabel" name="label_18">
|
<widget class="QLabel" name="label_18" >
|
||||||
<property name="text">
|
<property name="text" >
|
||||||
<string>Base &font size:</string>
|
<string>Base &font size:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy">
|
<property name="buddy" >
|
||||||
<cstring>opt_base_font_size</cstring>
|
<cstring>opt_base_font_size</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="1" column="2" >
|
||||||
<widget class="QDoubleSpinBox" name="opt_base_font_size">
|
<widget class="QDoubleSpinBox" name="opt_base_font_size" >
|
||||||
<property name="suffix">
|
<property name="suffix" >
|
||||||
<string> pt</string>
|
<string> pt</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="decimals">
|
<property name="decimals" >
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimum">
|
<property name="minimum" >
|
||||||
<double>0.000000000000000</double>
|
<double>0.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum" >
|
||||||
<double>30.000000000000000</double>
|
<double>30.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
<property name="singleStep">
|
<property name="singleStep" >
|
||||||
<double>1.000000000000000</double>
|
<double>1.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
<property name="value">
|
<property name="value" >
|
||||||
<double>15.000000000000000</double>
|
<double>15.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="3" column="0" >
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label" >
|
||||||
<property name="text">
|
<property name="text" >
|
||||||
<string>Line &height:</string>
|
<string>Line &height:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy">
|
<property name="buddy" >
|
||||||
<cstring>opt_line_height</cstring>
|
<cstring>opt_line_height</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="2">
|
<item row="3" column="2" >
|
||||||
<widget class="QDoubleSpinBox" name="opt_line_height">
|
<widget class="QDoubleSpinBox" name="opt_line_height" >
|
||||||
<property name="suffix">
|
<property name="suffix" >
|
||||||
<string> pt</string>
|
<string> pt</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="decimals">
|
<property name="decimals" >
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0" colspan="2">
|
<item row="5" column="0" colspan="2" >
|
||||||
<widget class="QCheckBox" name="opt_remove_paragraph_spacing">
|
<widget class="QCheckBox" name="opt_remove_paragraph_spacing" >
|
||||||
<property name="text">
|
<property name="text" >
|
||||||
<string>Remove &spacing between paragraphs</string>
|
<string>Remove &spacing between paragraphs</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0" colspan="2">
|
<item row="6" column="0" colspan="2" >
|
||||||
<widget class="QCheckBox" name="opt_dont_justify">
|
<widget class="QCheckBox" name="opt_dont_justify" >
|
||||||
<property name="text">
|
<property name="text" >
|
||||||
<string>No text &justification</string>
|
<string>No text &justification</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0" colspan="2">
|
<item row="7" column="0" colspan="2" >
|
||||||
<widget class="QCheckBox" name="opt_linearize_tables">
|
<widget class="QCheckBox" name="opt_linearize_tables" >
|
||||||
<property name="text">
|
<property name="text" >
|
||||||
<string>&Linearize tables</string>
|
<string>&Linearize tables</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0" colspan="2">
|
<item row="8" column="0" colspan="2" >
|
||||||
<widget class="QCheckBox" name="opt_remove_first_image">
|
<widget class="QCheckBox" name="opt_remove_first_image" >
|
||||||
<property name="text">
|
<property name="text" >
|
||||||
<string>Remove &first image from source file</string>
|
<string>Remove &first image from source file</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="2" column="0" >
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2" >
|
||||||
<property name="text">
|
<property name="text" >
|
||||||
<string>Font size &key:</string>
|
<string>Font size &key:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy">
|
<property name="buddy" >
|
||||||
<cstring>opt_font_size_mapping</cstring>
|
<cstring>opt_font_size_mapping</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1" colspan="2">
|
<item row="2" column="1" colspan="2" >
|
||||||
<widget class="QLineEdit" name="opt_font_size_mapping"/>
|
<widget class="QLineEdit" name="opt_font_size_mapping" />
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="0" colspan="2">
|
<item row="9" column="0" colspan="2" >
|
||||||
<widget class="QCheckBox" name="opt_insert_metadata">
|
<widget class="QCheckBox" name="opt_insert_metadata" >
|
||||||
<property name="text">
|
<property name="text" >
|
||||||
<string>Insert &metadata at start of book</string>
|
<string>Insert &metadata at start of book</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" colspan="2">
|
<item row="4" column="0" colspan="2" >
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3" >
|
||||||
<property name="text">
|
<property name="text" >
|
||||||
<string>Input character &encoding</string>
|
<string>Input character &encoding</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy">
|
<property name="buddy" >
|
||||||
<cstring>opt_input_encoding</cstring>
|
<cstring>opt_input_encoding</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="2">
|
<item row="4" column="2" >
|
||||||
<widget class="QLineEdit" name="opt_input_encoding"/>
|
<widget class="QLineEdit" name="opt_input_encoding" />
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0" >
|
||||||
|
<widget class="QCheckBox" name="opt_disable_font_rescaling" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>&Disable font size rescaling</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox" >
|
||||||
<property name="title">
|
<property name="title" >
|
||||||
<string>Extra &CSS</string>
|
<string>Extra &CSS</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3" >
|
||||||
<item row="0" column="0">
|
<item row="0" column="0" >
|
||||||
<widget class="QTextEdit" name="opt_extra_css"/>
|
<widget class="QTextEdit" name="opt_extra_css" />
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@ -146,8 +152,41 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../../../work/calibre-pluginize/src/calibre/gui2/images.qrc"/>
|
<include location="../images.qrc" />
|
||||||
<include location="../images.qrc"/>
|
<include location="../images.qrc" />
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>opt_disable_font_rescaling</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>opt_base_font_size</receiver>
|
||||||
|
<slot>setDisabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel" >
|
||||||
|
<x>154</x>
|
||||||
|
<y>16</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel" >
|
||||||
|
<x>385</x>
|
||||||
|
<y>40</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>opt_disable_font_rescaling</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>opt_font_size_mapping</receiver>
|
||||||
|
<slot>setDisabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel" >
|
||||||
|
<x>80</x>
|
||||||
|
<y>20</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel" >
|
||||||
|
<x>285</x>
|
||||||
|
<y>72</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user