The Grand Font Selection Redesign:

* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).

        * lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).

        * lib/chkconfig.ltx: Test for newly supported font packages

        * lib/doc/LaTeXConfig.lyx.in: document newly supported font packages

        * lib/doc/UserGuide.lyx: document new UI.

        * lib/doc/Extended.lyx: update PostScript font documentation

        * development/FORMAT: document file format change 246->247.

        * src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans, 
           tex_fonts_monospaced (with GUI equivalents).

        * src/buffer.C: Format up to 247.

        * src/bufferparams.C:
        new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,    
        fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
        (LyXFont const BufferParams::getFont): consider switch of default family.
        (string const BufferParams::loadFonts): new method to get all the LaTeX 
        font stuff done.

        * src/paragraph.C
        (LyXFont const Paragraph::getFont):
        (LyXFont const Paragraph::getLabelFont):
        (LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's 
        default font

        * src/text.C
        (int LyXText::leftMargin):
        (int LyXText::rightMargin): user buffer's not textclass's default font

        * src/text2.C
        (LyXFont LyXText::getFont):
        (LyXFont LyXText::getLayoutFont):
        (LyXFont LyXText::getLabelFont): check if the family of the default document 
        font has been customized.

        * src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).

        * src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM). 

        * src/frontends/qt3/Makefile.dialogs: add new FontModuleBase

        * src/frontends/qt3/ui/FontModuleBase.ui: new File

        * src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets

        * src/frontends/qt3/QDocument.C
        * src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui

        * src/frontends/qt4/Makefile.dialogs: add new FontUi

        * src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui

        * src/frontends/qt4/ui/FontUi.ui: new File

        * src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets

        * src/frontends/qt4/ui/compile_uic.sh: add new FontUi

        * src/frontends/xforms/FormDocument.[Ch]: implement new font ui

        * src/frontends/xforms/forms/form_document.fd: add new font tab.

        * src/frontends/controllers/ControlDocument.[Ch]
        (char ControlDocument::fontfamilies):
        (char ControlDocument::fontfamilies_gui):
        (bool ControlDocument::isFontAvailable):
        (bool ControlDocument::providesSC):
        (bool ControlDocument::providesOSF):
        (bool ControlDocument::providesScale): new methods, providing font info.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2006-06-19 08:10:17 +00:00
parent 3ac0c3f587
commit 54acb900ad
35 changed files with 2969 additions and 433 deletions

View File

@ -1,6 +1,44 @@
LyX file-format changes
-----------------------
2006-06-10 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* format incremented to 247. The Grand Font Interface Rewrite.
(1) Split font selection to rm, sf, tt:
\fontscheme -> \font_roman, \font_sans, \font_typewriter
Change 246->247:
\fontscheme \font_roman \font_sans \font_typewriter
default default default default
ae ae default default
times times default default
palatino palatino default default
helvet default helvet default
avant default avant default
newcent newcent default default
bookman bookman default default
pslatex times (or \usepackage{pslatex})
New 246->247:
\font_roman: cmr (-> \renewcommand{\rmdefault}{cmr}),
lmodern, charter, utopia, ccfonts, chancery, beraserif
(-> \usepackage{<name>})
\font_sans: cmss, lmss, cmbr
(-> \renewcommand{\sfdefault}{<name>})
berasans (-> \usepackage{<name>})
\font_typewriter: cmtt, lmtt, cmtl,
(-> \renewcommand{\sfdefault}{<name>})
courier, luximono, beramono
(-> \usepackage{<name>})
(2) New param \font_default_family (rmdefault, sfdefault, ttdefault)
(3) New param \font_sc (true, false).
(4) New param \font_osf (true, false).
(5) New param \font_sf_scale (float)
(6) New param \font_tt_scale (float)
Support for the following fonts has been added:
bera, ccfonts, chancery, charter, cmbright, computer modern (explicitely),
courier, lmodern, luximono, utopia.
Support for the following font has been removed:
pslatex (it's superseded by mathptmx (times)).
2006-06-03 Martin Vermeer <martin.vermeer@hut.fi>
* format incremented to 246. The framed.sty package is

View File

@ -256,6 +256,28 @@
% times.sty. If times.sty is here, we will assume that everything is
% fine.
\TestPackage[times.sty]{psnfss}
% not sure if these are in all versions of psnfss
\TestPackage{mathptmx}
\TestPackage{mathptm}
\TestPackage{mathpazo}
\TestPackage{mathpple}
\TestPackage{utopia}
\TestPackage{avant}
\TestPackage{bookman}
\TestPackage{newcent}
\TestPackage{charter}
\TestPackage{chancery}
% Other font packages
\TestPackage{lmodern}
\TestPackage{ae}
\TestPackage{fourier}
\TestPackage{cmbright}
\TestPackage{luximono}
\TestPackage{ccfonts}
\TestPackage{eco}
\TestPackage{bera}
\TestPackage{tipa}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% END ACTUAL CONFIGURATION INSPECTION CODE %%%%%%%%%%%%%%%%%%%%%%%%%%%%

View File

@ -15855,18 +15855,70 @@ If the default LaTeX font encoding (OT1) is used, nothing else need to be
done.
However, if the T1 font encoding is used, then LaTeX uses the newer EC
fonts, for which there are no Type1 version.
The solution is to use the ae package which emulates T1 coded fonts using
the standard CM fonts.
This is done by adding
\family typewriter
There are two solutions in this case: Either use the
\begin_inset Quotes eld
\end_inset
\backslash
usepackage{ae,aecompl}
ae font
\begin_inset Quotes erd
\end_inset
(which is in fact a
\begin_inset Quotes eld
\end_inset
virtual
\begin_inset Quotes erd
\end_inset
font that emulates T1 coded fonts using the standard CM fonts).
This is done by selecting
\begin_inset Quotes eld
\end_inset
AE (Almost European)
\begin_inset Quotes erd
\end_inset
from
\family sans
Document\SpecialChar \menuseparator
Settings\SpecialChar \menuseparator
Fonts\SpecialChar \menuseparator
Roman
\family default
to the preamble of the LyX file.
.
However, some glyphs are missing from the CM fonts (e.g.
eth, thorn), and they are taken from the EC fonts.
Therefore you get these glyphs as bitmaps.
Or use the
\begin_inset Quotes eld
\end_inset
Latin Modern
\begin_inset Quotes erd
\end_inset
font from
\family sans
Document\SpecialChar \menuseparator
Settings\SpecialChar \menuseparator
Fonts\SpecialChar \menuseparator
Roman
\family default
.
It is a newer and probably the best Postscript® Type 1 version of cm.
Basically, we recommend this over the
\begin_inset Quotes eld
\end_inset
ae
\begin_inset Quotes erd
\end_inset
solution.
However, the Latin Modern fonts differ from cm in some visual aspects,
which does not please everybody.
\end_layout
\begin_layout Standard
@ -15895,11 +15947,24 @@ Misc
\begin_layout Standard
An alternate option is to use the standard Postscript® fonts instead of
the Computer Modern fonts.
To do that, you need to select
\family sans
pslatex
\family default
as the global font in the document layout dialog.
To do that, you just need to select one of the fonts listed in the document
layout dialog (except for
\begin_inset Quotes eld
\end_inset
default
\begin_inset Quotes erd
\end_inset
and
\begin_inset Quotes eld
\end_inset
computer modern
\begin_inset Quotes erd
\end_inset
, they're all Postscript® fonts).
When using the Postscript® fonts, the result PDF file is smaller as the
fonts are not saved into the file.
Furthermore, the Postscript® fonts include all T1 glyphs.

View File

@ -1,4 +1,4 @@
#LyX 1.4.1svn created this file. For more info see http://www.lyx.org/
#LyX 1.4.2svn created this file. For more info see http://www.lyx.org/
\lyxformat 245
\begin_document
\begin_header
@ -282,6 +282,88 @@ ec
They are used automatically if LyX determines that you have them installed.
\end_layout
\begin_layout Subsection
Latin Modern
\end_layout
\begin_layout Description
Found: @chk_lmodern@
\end_layout
\begin_layout Description
CTAN:
\family sans
fonts/lm/
\end_layout
\begin_layout Description
Notes: The
\family sans
Latin Modern
\family default
fonts are PostScript® versions of LaTeX' standard font (Computer Modern).
They aim to become the default LaTeX font eventually.
We recommend to use them instead of other PostScript® versions of Computer
Modern (like AE).
\end_layout
\begin_layout Subsection
Almost European (AE)
\end_layout
\begin_layout Description
Found: @chk_ae@
\end_layout
\begin_layout Description
CTAN:
\family sans
fonts/ae/
\end_layout
\begin_layout Description
Notes: The
\family sans
AE
\family default
package provide virtual PostScript® versions of LaTeX' standard font (Computer
Modern).
Unless you rely on special characters, we recommend to use
\family sans
Latin Modern
\family default
instead.
\end_layout
\begin_layout Subsection
Eco
\end_layout
\begin_layout Description
Found: @chk_eco@
\end_layout
\begin_layout Description
CTAN:
\family sans
fonts/eco/
\end_layout
\begin_layout Description
Notes: The
\family sans
eco
\family default
package is used by LyX to access the old style numerals of the
\family sans
Computer Modern
\family default
font family.
\end_layout
\begin_layout Subsection
psnfss
\end_layout
@ -297,12 +379,12 @@ macros/latex/required/psnfss/
\end_layout
\begin_layout Description
Notes: The package
Notes: The
\family sans
psnfss
\family default
allows you to change the fonts used by LyX to one of the 35 classical fonts
available on PostScript® printers.
bundle allows you to change the fonts used by LyX to one of the 35 classical
fonts available on PostScript® printers.
Currently, the support for
\family sans
psnfss
@ -317,6 +399,303 @@ Layout->Document
.
\end_layout
\begin_layout Standard
Different versions of
\family sans
psnfss
\family default
provide different font packages.
Even if LyX supports the deprecated packages as well, we recommend that
you take care to have the newest ones installed.
A recent
\family sans
psnfss
\family default
bundle should at least include:
\end_layout
\begin_layout Itemize
\family sans
mathpazo
\family default
(newest Palatino support).
\series bold
Found:
\series default
@chk_mathpazo@
\end_layout
\begin_layout Itemize
\family sans
mathpple
\family default
(deprecated Palatino support).
\series bold
Found:
\series default
@chk_mathpple@
\end_layout
\begin_layout Itemize
\family sans
mathptmx
\family default
(newest Times support).
\series bold
Found:
\series default
@chk_mathptmx@
\end_layout
\begin_layout Itemize
\family sans
mathptm
\family default
(deprecated Times support).
\series bold
Found:
\series default
@chk_mathptm@
\end_layout
\begin_layout Itemize
\family sans
utopia
\family default
(Utopia).
\series bold
Found:
\series default
@chk_utopia@
\end_layout
\begin_layout Itemize
\family sans
avant
\family default
(Avant Garde).
\series bold
Found:
\series default
@chk_avant@
\end_layout
\begin_layout Itemize
\family sans
bookman
\family default
(Bookman).
\series bold
Found:
\series default
@chk_bookman@
\end_layout
\begin_layout Itemize
\family sans
charter
\family default
(Charter).
\series bold
Found:
\series default
@chk_charter@
\end_layout
\begin_layout Itemize
\family sans
newcent
\family default
(New Century Gothic).
\series bold
Found:
\series default
@chk_newcent@
\end_layout
\begin_layout Itemize
\family sans
chancery
\family default
(Zapf Chancery).
\series bold
Found:
\series default
@chk_chancery@
\end_layout
\begin_layout Subsection
fourier-GUTenberg
\end_layout
\begin_layout Description
Found: @chk_fourier@
\end_layout
\begin_layout Description
CTAN:
\family sans
fonts/fourier-GUT
\end_layout
\begin_layout Description
Notes: The
\family sans
fourier
\family default
package provides support for the Utopia PostScript® font.
Contrary to the
\family sans
utopia
\family default
package that ships with
\family sans
PSNFSS
\family default
bundle, it also provides suitable math fonts.
If this package is installed, it will be used instead of
\family sans
utopia
\family default
if you select the Utopia font.
\end_layout
\begin_layout Subsection
CM bright
\end_layout
\begin_layout Description
Found: @chk_cmbright@
\end_layout
\begin_layout Description
CTAN:
\family sans
fonts/cmbright
\end_layout
\begin_layout Description
Notes: CM bright is a sans serif font that also provides nice sans serif
math fonts.
\end_layout
\begin_layout Subsection
Bera
\end_layout
\begin_layout Description
Found: @chk_bera@
\end_layout
\begin_layout Description
CTAN:
\family sans
fonts/bera
\end_layout
\begin_layout Description
Notes: The bera fonts are a clone of Bitstream Vera, including Bera Serif
(a slab-serif Roman), Bera Sans (a Frutiger descendant), and Bera Mono
(monospaced/typewriter).
\end_layout
\begin_layout Subsection
Concrete
\end_layout
\begin_layout Description
Found: @chk_ccfonts@
\end_layout
\begin_layout Description
CTAN:
\family sans
macros/latex/contrib/ccfonts/
\end_layout
\begin_layout Description
Notes: The
\family sans
ccfonts
\family default
package provides support for the font that has been designed by Donald Knuth
for his
\emph on
Concrete Mathematics
\emph default
book, hence called concrete fonts.
\end_layout
\begin_layout Subsection
LuxiMono
\end_layout
\begin_layout Description
Found: @chk_luximono@
\end_layout
\begin_layout Description
CTAN:
\family sans
fonts/LuxiMono/
\end_layout
\begin_layout Description
Notes: The
\family sans
luximono
\family default
package provides support for the monospaced Luxida Mono font.
\end_layout
\begin_layout Subsection
TIPA
\end_layout
\begin_layout Description
Found: @chk_tipa@
\end_layout
\begin_layout Description
CTAN:
\family sans
fonts/tipa/
\end_layout
\begin_layout Description
Notes: The
\family sans
tipa
\family default
package provides comprehensive support and fonts for typesetting phonetic
symbols, as defined in the
\emph on
International Phonetic Alphabet
\emph default
(IPA).
The input of these symbols is provided by LyX's math editor.
\end_layout
\begin_layout Section
Standard LaTeX document classes
\end_layout
@ -1167,9 +1546,10 @@ CTAN: N/A
\begin_layout Description
WWW: available from the site
\begin_inset LatexCommand \url{http://www.worldscinet.com/ijmpc/mkt/guidelines.s
html}
\begin_inset LatexCommand \url{http://www.worldscinet.com/ijmpc/mkt/guidelines.s}
\end_inset
.
\end_layout

View File

@ -1,4 +1,4 @@
#LyX 1.4.0cvs created this file. For more info see http://www.lyx.org/
#LyX 1.4.2svn created this file. For more info see http://www.lyx.org/
\lyxformat 245
\begin_document
\begin_header
@ -4761,6 +4761,7 @@ If you are in one of these environments:
status collapsed
\begin_layout Standard
\end_layout
@ -4775,6 +4776,7 @@ status collapsed
\begin_layout Standard
\backslash
vspace{-2ex}
\backslash
@ -4803,6 +4805,7 @@ Quotation
status collapsed
\begin_layout Standard
}
\backslash
parbox[t]{3cm}{
@ -4830,6 +4833,7 @@ Itemize
status collapsed
\begin_layout Standard
}
\backslash
parbox[t]{3cm}{
@ -4857,6 +4861,7 @@ Description
status collapsed
\begin_layout Standard
}
\backslash
parbox[t]{3cm}{
@ -4878,6 +4883,7 @@ List
status collapsed
\begin_layout Standard
}
\end_layout
@ -6420,6 +6426,7 @@ status collapsed
\begin_layout Standard
\backslash
linebreak
\end_layout
@ -10211,29 +10218,24 @@ S
ettings
\family default
dialog.
There are two options of interest here,
The
\family sans
\bar under
F
\bar default
onts
Fonts
\family default
tabfolder/pane offers you a variety of possibilities to set up and adjust
your document fonts.
The most important ones are those in the
\family sans
Font Families
\family default
and
\family sans
Font\InsetSpace ~
\bar under
S
\bar default
ize
Font Sizes
\family default
.
group.
The possible options under
\family sans
\bar under
F
\bar default
onts
Font Families
\family default
include
\begin_inset Quotes eld
@ -10241,26 +10243,52 @@ onts
\family sans
default
Default
\family default
\begin_inset Quotes erd
\end_inset
and a list of fonts available on your system.
and a list of fonts available on your system, each for the
\family sans
\bar under
R
\bar default
oman
\family default
,
\family sans
\bar under
S
\bar default
ans Serif
\family default
and
\family sans
T
\bar under
y
\bar default
pewriter
\family default
(a.\InsetSpace \thinspace{}
k.\InsetSpace \thinspace{}
a.
Monospaced) family of fonts.
The option
\begin_inset Quotes eld
\end_inset
\family sans
default
Default
\family default
\begin_inset Quotes erd
\end_inset
uses the standard TeX fonts, known as
uses the fonts that are specified by the document class you are using.
Often, these are the standard TeX fonts, known as
\begin_inset Quotes eld
\end_inset
@ -10277,24 +10305,125 @@ European modern
\end_inset
(ec).
Most systems will typically have some version of a Times and Helvetica
font, with other variants.
You'll have to examine this for yourself.
Depending on the document class, however, it might as well be another font.
Most fonts in the list should be installed on your system.
For others, you might have to get and install the fonts first (LyX indicates
if a font is not installed).
Please have a look at
\family sans
\bar under
H
\bar default
elp\SpecialChar \menuseparator
\bar under
L
\bar default
aTeX Configuration
\family default
about where to get the fonts.
Installing a new font for LaTeX is, unfortunately, not as easy as installing
a new font to common operation systems.
However, most font packages include a step-by-step instruction.
\end_layout
\begin_layout Standard
As for the
In most cases, the default family of a document class is roman (a.\InsetSpace \thinspace{}
k.\InsetSpace \thinspace{}
a.
serif), so the roman font (e.\InsetSpace \thinspace{}
g.
Times) will be used all over, unless you select
\begin_inset Quotes eld
\end_inset
Sans Serif
\begin_inset Quotes erd
\end_inset
od
\begin_inset Quotes eld
\end_inset
Typewriter
\begin_inset Quotes erd
\end_inset
from
\family sans
\bar under
E
\bar default
dit\SpecialChar \menuseparator
Text St
\bar under
y
\bar default
le
\family default
for specific selections of the text (see below section
\begin_inset LatexCommand \ref{sub:Text-Style-Dialog}
\end_inset
).
\family sans
\family default
The
\family sans
Default\InsetSpace ~
Family
\family default
option lets you change this.
So if you want your document (including footnotes etc.), say, all over in
Helvetica, chose
\begin_inset Quotes eld
\end_inset
Helvetica
\begin_inset Quotes erd
\end_inset
as
\family sans
Sans Serif
\family default
Font and
\begin_inset Quotes eld
\end_inset
Sans Serif
\begin_inset Quotes erd
\end_inset
as
\family sans
Default\InsetSpace ~
Family
\family default
.
\end_layout
\begin_layout Standard
In the
\family sans
Font\InsetSpace ~
\bar under
S
\bar default
ize
izes
\family default
option, there are three possible values:
group, you can usually select from four possible
\family sans
10
Base\InsetSpace ~
Size
\family default
values:
\family sans
default, 10
\family default
,
\family sans
@ -10304,7 +10433,7 @@ ize
\family sans
12
\family default
.
(some document classes provide more, some less choices).
Remember, this is the
\emph on
base
@ -10319,7 +10448,76 @@ base
\end_layout
\begin_layout Standard
Note that once you choose a new value for
Some Sans Serif and Typewriter Fonts provide the possibility to be scaled.
This might be useful, if a Sans Serif or Typewriter Font has a different
height than the Roman Font.
Please be careful with this option, it can be easily misused.
\end_layout
\begin_layout Standard
In the
\family sans
Advanced Options
\family default
group box, you'll finally find possibilities for using so-called
\begin_inset Quotes eld
\end_inset
expert settings
\begin_inset Quotes erd
\end_inset
, given that they are provided by a certain font.
\family sans
Use true S
\bar under
m
\bar default
all Caps
\family default
indicates that lots of fonts do not use real, but
\emph on
faked
\emph default
Small Caps.
True Small Caps are specifically designed characters, whereas faked Small
Caps are just scaled Capital letters.
The former looks way better, so if a font offers you the choice, you should
check this option.
\family sans
Use
\bar under
O
\bar default
ld Style Figures
\family default
finally lets you select so called Old Style Figures (a.\InsetSpace \thinspace{}
k.\InsetSpace \thinspace{}
a.
Medieval Figures, i.\InsetSpace \thinspace{}
e.
figures with ascending or descending form) instead of the standard Lining
Figures.
Old Style Figures are often preferred due to better legibility in the text,
but it's certainly also a matter of taste.
Just try it out, if it is provided for your font of choice.
Note that math figures are
\emph on
not
\emph default
affected by this choice.
\end_layout
\begin_layout Standard
Please note that even if LyX tries its best in guessing what fonts are installed
and which options are provided by a given font, it might fail if the fonts
are not set up correctly.
\end_layout
\begin_layout Standard
Note further that once you choose a new value for
\family sans
\bar under
F
@ -10342,8 +10540,29 @@ not
change the screen.
You'll only see a difference once you generate the final output.
This is part of the WYSIWYM concept.
Besides, you have certainly noticed that "Roman" text on the LyX screen
corresponds to the default font.
The only visible change is caused by a change of the default font family.
However, you certainly noticed that, for instance, the roman font on screen
is just a representation of
\begin_inset Quotes eld
\end_inset
Roman
\begin_inset Quotes erd
\end_inset
(as set up in the
\family sans
\bar under
T
\bar default
ools\SpecialChar \menuseparator
\bar under
P
\bar default
references
\family default
dialog), not of the actual roman document font.
\end_layout
\begin_layout Subsection
@ -10495,6 +10714,11 @@ Fine-Tuning with the
Character Layout
\family default
dialog
\begin_inset LatexCommand \label{sub:Text-Style-Dialog}
\end_inset
\end_layout
\begin_layout Standard
@ -12019,6 +12243,7 @@ status collapsed
\begin_layout Standard
\backslash
/
\end_layout
@ -12051,6 +12276,7 @@ status collapsed
\begin_layout Standard
\backslash
/
\end_layout
@ -12063,6 +12289,7 @@ status collapsed
\begin_layout Standard
\backslash
/
\end_layout
@ -24340,6 +24567,7 @@ status collapsed
\begin_layout Standard
\backslash
textcent
\end_layout
@ -24873,6 +25101,7 @@ status collapsed
\begin_layout Standard
\backslash
textcurrency
\end_layout
@ -25146,6 +25375,7 @@ status collapsed
\begin_layout Standard
\backslash
textyen
\end_layout
@ -25419,6 +25649,7 @@ status collapsed
\begin_layout Standard
\backslash
textbrokenbar
\end_layout
@ -27254,6 +27485,7 @@ status collapsed
\begin_layout Standard
\backslash
textendash
\end_layout
@ -28447,6 +28679,7 @@ status collapsed
\begin_layout Standard
\backslash
href{http://www.lyx.org/about/credits.php}{
\end_layout
@ -28462,6 +28695,7 @@ CREDITS
status collapsed
\begin_layout Standard
}
\end_layout

View File

@ -48,8 +48,8 @@ format_relation = [("0_10", [210], ["0.10.7","0.10"]),
("1_1_6fix3", [218], ["1.1.6fix3","1.1.6fix4","1.1"]),
("1_2", [220], ["1.2.0","1.2.1","1.2.3","1.2.4","1.2"]),
("1_3", [221], ["1.3.0","1.3.1","1.3.2","1.3.3","1.3.4","1.3.5","1.3.6","1.3"]),
("1_4", range(222,245), ["1.4.0", "1.4.1", "1.4.2svn"]),
("1_5", [245,246], ["1.5.0svn"])]
("1_4", range(222,246), ["1.4.0", "1.4.1", "1.4.2svn"]),
("1_5", range(246,248), ["1.5.0svn"])]
def formats_list():
@ -484,7 +484,14 @@ class NewFile(LyX_Base):
"\\textclass article",
"\\language english",
"\\inputencoding auto",
"\\fontscheme default",
"\\font_roman default",
"\\font_sans default",
"\\font_typewriter default",
"\\font_default_family default",
"\\font_sc false",
"\\font_osf false",
"\\font_sf_scale 100",
"\\font_tt_scale 100",
"\\graphics default",
"\\paperfontsize default",
"\\papersize default",

View File

@ -16,7 +16,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
from parser_tools import find_tokens
from parser_tools import find_token_exact, find_tokens, get_value
##
# Notes: Framed/Shaded
@ -32,12 +32,153 @@ def revert_framed(file):
file.body[i] = "\\begin_inset Note"
i = i + 1
##
# Fonts
#
roman_fonts = {'default' : 'default', 'ae' : 'ae',
'times' : 'times', 'palatino' : 'palatino',
'helvet' : 'default', 'avant' : 'default',
'newcent' : 'newcent', 'bookman' : 'bookman',
'pslatex' : 'times'}
sans_fonts = {'default' : 'default', 'ae' : 'default',
'times' : 'default', 'palatino' : 'default',
'helvet' : 'helvet', 'avant' : 'avant',
'newcent' : 'default', 'bookman' : 'default',
'pslatex' : 'helvet'}
typewriter_fonts = {'default' : 'default', 'ae' : 'default',
'times' : 'default', 'palatino' : 'default',
'helvet' : 'default', 'avant' : 'default',
'newcent' : 'default', 'bookman' : 'default',
'pslatex' : 'courier'}
def convert_font_settings(file):
i = 0
i = find_token_exact(file.header, "\\fontscheme", i)
if i == -1:
file.warning("Malformed LyX file: Missing `\\fontscheme'.")
return
font_scheme = get_value(file.header, "\\fontscheme", i, i + 1)
if font_scheme == '':
file.warning("Malformed LyX file: Empty `\\fontscheme'.")
font_scheme = 'default'
if not font_scheme in roman_fonts.keys():
file.warning("Malformed LyX file: Unknown `\\fontscheme' `%s'." % font_scheme)
font_scheme = 'default'
file.header[i:i+1] = ['\\font_roman %s' % roman_fonts[font_scheme],
'\\font_sans %s' % sans_fonts[font_scheme],
'\\font_typewriter %s' % typewriter_fonts[font_scheme],
'\\font_default_family default',
'\\font_sc false',
'\\font_osf false',
'\\font_sf_scale 100',
'\\font_tt_scale 100']
def revert_font_settings(file):
i = 0
insert_line = -1
fonts = {'roman' : 'default', 'sans' : 'default', 'typewriter' : 'default'}
for family in 'roman', 'sans', 'typewriter':
name = '\\font_%s' % family
i = find_token_exact(file.header, name, i)
if i == -1:
file.warning("Malformed LyX file: Missing `%s'." % name)
i = 0
else:
if (insert_line < 0):
insert_line = i
fonts[family] = get_value(file.header, name, i, i + 1)
del file.header[i]
i = find_token_exact(file.header, '\\font_default_family', i)
if i == -1:
file.warning("Malformed LyX file: Missing `\\font_default_family'.")
font_default_family = 'default'
else:
font_default_family = get_value(file.header, "\\font_default_family", i, i + 1)
del file.header[i]
i = find_token_exact(file.header, '\\font_sc', i)
if i == -1:
file.warning("Malformed LyX file: Missing `\\font_sc'.")
font_sc = 'false'
else:
font_sc = get_value(file.header, '\\font_sc', i, i + 1)
del file.header[i]
if font_sc != 'false':
file.warning("Conversion of '\\font_sc' not yet implemented.")
i = find_token_exact(file.header, '\\font_osf', i)
if i == -1:
file.warning("Malformed LyX file: Missing `\\font_osf'.")
font_osf = 'false'
else:
font_osf = get_value(file.header, '\\font_osf', i, i + 1)
del file.header[i]
i = find_token_exact(file.header, '\\font_sf_scale', i)
if i == -1:
file.warning("Malformed LyX file: Missing `\\font_sf_scale'.")
font_sf_scale = '100'
else:
font_sf_scale = get_value(file.header, '\\font_sf_scale', i, i + 1)
del file.header[i]
if font_sf_scale != '100':
file.warning("Conversion of '\\font_sf_scale' not yet implemented.")
i = find_token_exact(file.header, '\\font_tt_scale', i)
if i == -1:
file.warning("Malformed LyX file: Missing `\\font_tt_scale'.")
font_tt_scale = '100'
else:
font_tt_scale = get_value(file.header, '\\font_tt_scale', i, i + 1)
del file.header[i]
if font_tt_scale != '100':
file.warning("Conversion of '\\font_tt_scale' not yet implemented.")
for font_scheme in roman_fonts.keys():
if (roman_fonts[font_scheme] == fonts['roman'] and
sans_fonts[font_scheme] == fonts['sans'] and
typewriter_fonts[font_scheme] == fonts['typewriter']):
file.header.insert(insert_line, '\\fontscheme %s' % font_scheme)
if font_default_family != 'default':
file.preamble.append('\\renewcommand{\\familydefault}{\\%s}' % font_default_family)
if font_osf == 'true':
file.warning("Ignoring `\\font_osf = true'")
return
font_scheme = 'default'
file.header.insert(insert_line, '\\fontscheme %s' % font_scheme)
if fonts['roman'] == 'cmr':
file.preamble.append('\\renewcommand{\\rmdefault}{cmr}')
if font_osf == 'true':
file.preamble.append('\\usepackage{eco}')
font_osf = 'false'
for font in 'lmodern', 'charter', 'utopia', 'beraserif', 'ccfonts', 'chancery':
if fonts['roman'] == font:
file.preamble.append('\\usepackage{%s}' % font)
for font in 'cmss', 'lmss', 'cmbr':
if fonts['sans'] == font:
file.preamble.append('\\renewcommand{\\sfdefault}{%s}' % font)
for font in 'berasans':
if fonts['sans'] == font:
file.preamble.append('\\usepackage{%s}' % font)
for font in 'cmtt', 'lmtt', 'cmtl':
if fonts['typewriter'] == font:
file.preamble.append('\\renewcommand{\\ttdefault}{%s}' % font)
for font in 'courier', 'beramono', 'luximono':
if fonts['typewriter'] == font:
file.preamble.append('\\usepackage{%s}' % font)
if font_default_family != 'default':
file.preamble.append('\\renewcommand{\\familydefault}{\\%s}' % font_default_family)
if font_osf == 'true':
file.warning("Ignoring `\\font_osf = true'")
##
# Conversion hub
#
convert = [[246, []]]
revert = [[245, [revert_framed]]]
convert = [[246, []],
[247, [convert_font_settings]]]
revert = [[246, [revert_font_settings]],
[245, [revert_framed]]]
if __name__ == "__main__":
pass

View File

@ -146,7 +146,7 @@ extern BufferList bufferlist;
namespace {
int const LYX_FORMAT = 246;
int const LYX_FORMAT = 247;
} // namespace anon

View File

@ -26,6 +26,7 @@
#include "language.h"
#include "LaTeXFeatures.h"
#include "LColor.h"
#include "lyxfont.h"
#include "lyxlex.h"
#include "lyxrc.h"
#include "lyxtextclasslist.h"
@ -302,7 +303,14 @@ BufferParams::BufferParams()
secnumdepth = 3;
tocdepth = 3;
language = default_language;
fonts = "default";
fontsRoman = "default";
fontsSans = "default";
fontsTypewriter = "default";
fontsDefaultFamily = "default";
fontsSC = false;
fontsOSF = false;
fontsSansScale = 100;
fontsTypewriterScale = 100;
inputenc = "auto";
graphicsDriver = "default";
sides = LyXTextClass::OneSide;
@ -436,8 +444,22 @@ string const BufferParams::readToken(LyXLex & lex, string const & token)
lex >> inputenc;
} else if (token == "\\graphics") {
readGraphicsDriver(lex);
} else if (token == "\\fontscheme") {
lex >> fonts;
} else if (token == "\\font_roman") {
lex >> fontsRoman;
} else if (token == "\\font_sans") {
lex >> fontsSans;
} else if (token == "\\font_typewriter") {
lex >> fontsTypewriter;
} else if (token == "\\font_default_family") {
lex >> fontsDefaultFamily;
} else if (token == "\\font_sc") {
lex >> fontsSC;
} else if (token == "\\font_osf") {
lex >> fontsOSF;
} else if (token == "\\font_sf_scale") {
lex >> fontsSansScale;
} else if (token == "\\font_tt_scale") {
lex >> fontsTypewriterScale;
} else if (token == "\\paragraph_separation") {
string parsep;
lex >> parsep;
@ -587,7 +609,14 @@ void BufferParams::writeFile(ostream & os) const
if (language != ignore_language)
os << "\\language " << language->lang() << '\n';
os << "\\inputencoding " << inputenc
<< "\n\\fontscheme " << fonts
<< "\n\\font_roman " << fontsRoman
<< "\n\\font_sans " << fontsSans
<< "\n\\font_typewriter " << fontsTypewriter
<< "\n\\font_default_family " << fontsDefaultFamily
<< "\n\\font_sc " << convert<string>(fontsSC)
<< "\n\\font_osf " << convert<string>(fontsOSF)
<< "\n\\font_sf_scale " << fontsSansScale
<< "\n\\font_tt_scale " << fontsTypewriterScale
<< "\n\\graphics " << graphicsDriver << '\n';
if (!float_placement.empty()) {
@ -786,16 +815,17 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
// end of \documentclass defs
// font selection must be done before loading fontenc.sty
// The ae package is not needed when using OT1 font encoding.
if (fonts != "default" &&
(fonts != "ae" || lyxrc.fontenc != "default")) {
os << "\\usepackage{" << fonts << "}\n";
string const fonts =
loadFonts(features, fontsRoman, fontsSans,
fontsTypewriter, fontsSC, fontsOSF,
fontsSansScale, fontsTypewriterScale);
if (!fonts.empty()) {
os << fonts;
texrow.newline();
if (fonts == "ae") {
os << "\\usepackage{aecompl}\n";
texrow.newline();
}
}
if (fontsDefaultFamily != "default")
os << "\\renewcommand{\\familydefault}{\\"
<< fontsDefaultFamily << "}\n";
// this one is not per buffer
if (lyxrc.fontenc != "default") {
os << "\\usepackage[" << lyxrc.fontenc
@ -1111,6 +1141,12 @@ LyXFont const BufferParams::getFont() const
{
LyXFont f = getLyXTextClass().defaultfont();
f.setLanguage(language);
if (fontsDefaultFamily == "rmdefault")
f.setFamily(LyXFont::ROMAN_FAMILY);
else if (fontsDefaultFamily == "sfdefault")
f.setFamily(LyXFont::SANS_FAMILY);
else if (fontsDefaultFamily == "ttdefault")
f.setFamily(LyXFont::TYPEWRITER_FAMILY);
return f;
}
@ -1262,3 +1298,140 @@ string const BufferParams::babelCall(string const & lang_opts) const
tmp = string("\\usepackage[") + lang_opts + "]{babel}";
return tmp;
}
string const BufferParams::loadFonts(LaTeXFeatures & features, string const & rm,
string const & sf, string const & tt,
bool const & sc, bool const & osf,
int const & sfscale, int const & ttscale) const
{
/* The LaTeX font world is in a flux. In the PSNFSS font interface,
several packages have been replaced by others, that might not
be installed on every system. We have to take care for that
(see psnfss.pdf). We try to support all psnfss fonts as well
as the fonts that have become de facto standard in the LaTeX
world (e.g. Latin Modern). We do not support obsolete fonts
(like PSLatex). In general, it should be possible to mix any
rm font with any sf or tt font, respectively. (JSpitzm)
TODO:
-- separate math fonts.
*/
if (rm == "default" && sf == "default" && tt == "default")
//nothing to do
return string();
ostringstream os;
// ROMAN FONTS
// Computer Modern (must be explicitely selectable -- there might be classes
// that define a different default font!
if (rm == "cmr") {
os << "\\renewcommand{\\rmdefault}{cmr}\n";
// osf for Computer Modern needs eco.sty
if (osf)
os << "\\usepackage{eco}\n";
}
// Latin Modern Roman
else if (rm == "lmodern")
os << "\\usepackage{lmodern}\n";
// AE
else if (rm == "ae") {
// not needed when using OT1 font encoding.
if (lyxrc.fontenc != "default")
os << "\\usepackage{ae,aecompl}\n";
}
// Times
else if (rm == "times") {
// try to load the best available package
if (features.isAvailable("mathptmx"))
os << "\\usepackage{mathptmx}\n";
else if (features.isAvailable("mathptm"))
os << "\\usepackage{mathptm}\n";
else
os << "\\usepackage{times}\n";
}
// Palatino
else if (rm == "palatino") {
// try to load the best available package
if (features.isAvailable("mathpazo")) {
os << "\\usepackage";
if (osf || sc) {
os << '[';
if (!osf)
os << "sc";
else
// "osf" includes "sc"!
os << "osf";
os << ']';
}
os << "{mathpazo}\n";
}
else if (features.isAvailable("mathpple"))
os << "\\usepackage{mathpple}\n";
else
os << "\\usepackage{palatino}\n";
}
// Utopia
else if (rm == "utopia") {
// fourier supersedes utopia.sty, but does
// not work with OT1 encoding.
if (features.isAvailable("fourier")
&& lyxrc.fontenc != "default") {
os << "\\usepackage";
if (osf || sc) {
os << '[';
if (sc)
os << "expert";
if (osf && sc)
os << ',';
if (osf)
os << "oldstyle";
os << ']';
}
os << "{fourier}\n";
}
else
os << "\\usepackage{utopia}\n";
}
// Bera (complete fontset)
else if (rm == "bera" && sf == "default" && tt == "default")
os << "\\usepackage{bera}\n";
// everything else
else if (rm != "default")
os << "\\usepackage" << "{" << rm << "}\n";
// SANS SERIF
// Helvetica, Bera Sans
if (sf == "helvet" || sf == "berasans") {
if (sfscale != 100)
os << "\\usepackage[scaled=" << float(sfscale) / 100
<< "]{" << sf << "}\n";
else
os << "\\usepackage{" << sf << "}\n";
}
// Avant Garde
else if (sf == "avant")
os << "\\usepackage{" << sf << "}\n";
// Computer Modern, Latin Modern, CM Bright
else if (sf != "default")
os << "\\renewcommand{\\sfdefault}{" << sf << "}\n";
// monospaced/typewriter
// Courier, LuxiMono
if (tt == "luximono" || tt == "beramono") {
if (ttscale != 100)
os << "\\usepackage[scaled=" << float(ttscale) / 100
<< "]{" << tt << "}\n";
else
os << "\\usepackage{" << tt << "}\n";
}
// Courier
else if (tt == "courier" )
os << "\\usepackage{" << tt << "}\n";
// Computer Modern, Latin Modern, CM Bright
else if (tt != "default")
os << "\\renewcommand{\\ttdefault}{" << tt << "}\n";
return os.str();
}

View File

@ -147,8 +147,22 @@ public:
/* some LaTeX options */
/// The graphics driver
std::string graphicsDriver;
///
std::string fonts;
/// the rm font
std::string fontsRoman;
/// the sf font
std::string fontsSans;
/// the tt font
std::string fontsTypewriter;
/// the default family (rm, sf, tt)
std::string fontsDefaultFamily;
/// use expert Small Caps
bool fontsSC;
/// use Old Style Figures
bool fontsOSF;
/// the scale factor of the sf font
int fontsSansScale;
/// the scale factor of the tt font
int fontsTypewriterScale;
///
Spacing & spacing();
Spacing const & spacing() const;
@ -230,6 +244,11 @@ public:
std::string const paperSizeName() const;
///
std::string const babelCall(std::string const & lang_opts) const;
/// set up the document fonts
std::string const loadFonts(LaTeXFeatures & features, std::string const & rm,
std::string const & sf, std::string const & tt,
bool const & sc, bool const & osf,
int const & sfscale, int const & ttscale) const;
/// path of the current buffer
std::string filepath;

View File

@ -19,9 +19,13 @@
#include "BufferView.h"
#include "buffer_funcs.h"
#include "funcrequest.h"
#include "gettext.h"
#include "language.h"
#include "LaTeXFeatures.h"
#include "LColor.h"
#include "outputparams.h"
#include "lyxtextclasslist.h"
#include "tex-strings.h"
#include <sstream>
@ -31,6 +35,16 @@ using std::string;
namespace lyx {
namespace frontend {
char const * const ControlDocument::fontfamilies[5] = {
"default", "rmdefault", "sfdefault", "ttdefault", ""
};
char const * ControlDocument::fontfamilies_gui[5] = {
N_("Default"), N_("Roman"), N_("Sans Serif"), N_("Typewriter"), ""
};
ControlDocument::ControlDocument(Dialog & parent)
: Dialog::Controller(parent)
{}
@ -101,7 +115,7 @@ void ControlDocument::dispatchParams()
// Apply the BufferParams.
dispatch_bufferparams(kernel(), params(), LFUN_BUFFER_PARAMS_APPLY);
// redo the numbering if necessary
if (new_secnumdepth != old_secnumdepth)
updateLabels(kernel().buffer());
@ -157,5 +171,61 @@ void ControlDocument::saveAsDefault() const
dispatch_bufferparams(kernel(), params(), LFUN_BUFFER_SAVE_AS_DEFAULT);
}
bool const ControlDocument::isFontAvailable(std::string const & font) const
{
OutputParams runparams;
LaTeXFeatures features(kernel().buffer(), kernel().buffer().params(), runparams);
if (font == "default" || font == "cmr"
|| font == "cmss" || font == "cmtt")
// these are standard
return true;
else if (font == "lmodern" || font == "lmss" || font == "lmtt")
return features.isAvailable("lmodern");
else if (font == "times" || font == "palatino"
|| font == "helvet" || font == "courier")
return (features.isAvailable("psnfss"));
else if (font == "cmbr" || font == "cmtl")
return features.isAvailable("cmbright");
else if (font == "utopia")
return (features.isAvailable("utopia")
|| features.isAvailable("fourier"));
else if (font == "beraserif" || font == "berasans"
|| font == "beramono")
return features.isAvailable("bera");
else
return features.isAvailable(font);
}
bool const ControlDocument::providesOSF(std::string const & font) const
{
if (font == "cmr")
return isFontAvailable("eco");
else if (font == "palatino")
return isFontAvailable("mathpazo");
else
return false;
}
bool const ControlDocument::providesSC(std::string const & font) const
{
if (font == "palatino")
return isFontAvailable("mathpazo");
else if (font == "utopia")
return isFontAvailable("fourier");
else
return false;
}
bool const ControlDocument::providesScale(std::string const & font) const
{
return (font == "helvet" || font == "luximono"
|| font == "berasans" || font == "beramono");
}
} // namespace frontend
} // namespace lyx

View File

@ -26,6 +26,10 @@ namespace frontend {
*/
class ControlDocument : public Dialog::Controller {
public:
/// font family names for BufferParams::fontsDefaultFamily
static char const * const fontfamilies[5];
/// GUI names corresponding fontfamilies
static char const * fontfamilies_gui[5];
///
ControlDocument(Dialog &);
///
@ -50,6 +54,14 @@ public:
void saveAsDefault() const;
///
bool loadTextclass(textclass_type tc) const;
///
bool const isFontAvailable(std::string const & font) const;
/// does this font provide Old Style figures?
bool const providesOSF(std::string const & font) const;
/// does this font provide true Small Caps?
bool const providesSC(std::string const & font) const;
/// does this font provide size adjustment?
bool const providesScale(std::string const & font) const;
private:
///
boost::scoped_ptr<BufferParams> bp_;

View File

@ -41,6 +41,7 @@ namespace lyx {
using support::bformat;
using support::token;
using support::contains;
using support::findToken;
namespace frontend {
@ -117,19 +118,66 @@ void GDocument::doBuild()
psdrivercombo_.append_text(tex_graphics[i]);
}
xml_->get_widget("Font", box);
box->pack_start(fontcombo_, true, true, 0);
xml_->get_widget("FontSans", box);
box->pack_start(fontsanscombo_, true, true, 0);
box->show_all();
// Populate font combo
for (int i = 0; tex_fonts[i][0]; ++i) {
fontcombo_.append_text(tex_fonts[i]);
// Populate sans font combo
for (int i = 0; tex_fonts_sans_gui[i][0]; ++i) {
string font = _(tex_fonts_sans_gui[i]);
if (!controller().isFontAvailable(tex_fonts_sans[i]))
font += _(" (not installed)");
fontsanscombo_.append_text(font);
}
xml_->get_widget("FontRoman", box);
box->pack_start(fontromancombo_, true, true, 0);
box->show_all();
// Populate roman font combo
for (int i = 0; tex_fonts_roman_gui[i][0]; ++i) {
string font = _(tex_fonts_roman_gui[i]);
if (!controller().isFontAvailable(tex_fonts_roman[i]))
font += _(" (not installed)");
fontsanscombo_.append_text(font);
}
xml_->get_widget("FontTypewriter", box);
box->pack_start(fonttypewritercombo_, true, true, 0);
box->show_all();
// Populate typewriter font combo
for (int i = 0; tex_fonts_monospaced_gui[i][0]; ++i) {
string font = _(tex_fonts_monospaced_gui[i]);
if (!controller().isFontAvailable(tex_fonts_monospaced[i]))
font += _(" (not installed)");
fontsanscombo_.append_text(font);
}
xml_->get_widget("FontDefaultFamily", box);
box->pack_start(fontdefaultfamilycombo_, true, true, 0);
box->show_all();
// Populate font default family combo
for (int i = 0; ControlDocument::fontfamilies_gui[i][0]; ++i)
fontdefaultfamilycombo_.append_text(_(ControlDocument::fontfamilies_gui[i]));
xml_->get_widget("FontSize", box);
box->pack_start(fontsizecombo_, true, true, 0);
box->show_all();
xml_->get_widget("fontScCB", fontScCB_);
xml_->get_widget("fontOsfCB", fontOsfCB_);
xml_->get_widget("scaleSansSB", scaleSansSB_);
scaleSansSB_->set_range(10, 200);
scaleSansSB_->set_digits(0);
xml_->get_widget("scaleTypewriterSB", scaleTypewriterSB_);
scaleTypewriterSB_->set_range(10, 200);
scaleTypewriterSB_->set_digits(0);
Gtk::SpinButton * spin;
xml_->get_widget("LineSpacing", spin);
linespacingadj_ = spin->get_adjustment();
@ -352,8 +400,24 @@ void GDocument::update()
psdrivercombo_.set_active_text (params.graphicsDriver);
// Font & Size
fontcombo_.set_active_text (params.fonts);
int i = findToken(tex_fonts_sans, params.fontsSans);
if (i >= 0)
fontsanscombo_.set_active_text(_(tex_fonts_sans_gui[i]));
i = findToken(tex_fonts_sans, params.fontsRoman);
if (i >= 0)
fontromancombo_.set_active_text(_(tex_fonts_roman_gui[i]));
i = findToken(tex_fonts_monospaced, params.fontsTypewriter);
if (i >= 0)
fonttypewritercombo_.set_active_text(tex_fonts_monospaced_gui[i]);
i = findToken(ControlDocument::fontfamilies, params.fontsDefaultFamily);
if (i >= 0)
fontdefaultfamilycombo_.set_active_text(
_(ControlDocument::fontfamilies_gui[i]));
fontsizecombo_.set_active_text (params.fontsize);
scaleSansSB_->set_value(params.fontsSansScale);
scaleTypewriterSB_->set_value(params.fontsTypewriterScale);
fontScCB_->set_active(params.fontsSC);
fontOsfCB_->set_active(params.fontsOSF);
// Line Spacing
linespacingadj_->set_value(params.spacing().getValue());
@ -558,8 +622,16 @@ void GDocument::apply()
params.graphicsDriver = psdrivercombo_.get_active_text();
// Font & Size
params.fonts = fontcombo_.get_active_text();
params.fontsSans = tex_fonts_sans[fontsanscombo_.get_active_row_number()];
params.fontsRoman = tex_fonts_roman[fontromancombo_.get_active_row_number()];
params.fontsTypewriter = tex_fonts_monospaced[fonttypewritercombo_.get_active_row_number()];
params.fontsDefaultFamily =
ControlDocument::fontfamilies[fontdefaultfamilycombo_.get_active_row_number()];
params.fontsize = fontsizecombo_.get_active_text();
params.fontsSansScale = int(scaleSansSB_->get_adjustment()->get_value());
params.fontsTypewriterScale = int(scaleTypewriterSB_->get_adjustment()->get_value());
params.fontsSC = fontScCB_->get_active();
params.fontsOSF = fontOsfCB_->get_active();
// Line Spacing
params.spacing().set(Spacing::Other, linespacingadj_->get_value());

View File

@ -49,8 +49,15 @@ private:
Gtk::ComboBoxText classcombo_;
Gtk::Entry * extraoptionsentry_;
Gtk::ComboBoxText psdrivercombo_;
Gtk::ComboBoxText fontcombo_;
Gtk::ComboBoxText fontsanscombo_;
Gtk::ComboBoxText fontromancombo_;
Gtk::ComboBoxText fonttypewritercombo_;
Gtk::ComboBoxText fontdefaultfamilycombo_;
Gtk::ComboBoxText fontsizecombo_;
Gtk::CheckButton * fontScCB_;
Gtk::CheckButton * fontOsfCB_;
Gtk::SpinButton * scaleSansSB_;
Gtk::SpinButton * scaleTypewriterSB_;
Gtk::Adjustment * linespacingadj_;
Gtk::RadioButton * indentradio_;
Gtk::RadioButton * vspaceradio_;

View File

@ -300,7 +300,7 @@
<widget class="GtkTable" id="table7">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="n_rows">12</property>
<property name="n_rows">19</property>
<property name="n_columns">3</property>
<property name="homogeneous">False</property>
<property name="row_spacing">4</property>
@ -378,7 +378,7 @@
<child>
<widget class="GtkLabel" id="label30">
<property name="visible">True</property>
<property name="label" translatable="yes">_Font:</property>
<property name="label" translatable="yes">_Roman Font:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@ -388,7 +388,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">Font</property>
<property name="mnemonic_widget">FontRoman</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
@ -405,7 +405,7 @@
</child>
<child>
<widget class="GtkVBox" id="Font">
<widget class="GtkVBox" id="FontRoman">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
@ -425,7 +425,36 @@
</child>
<child>
<widget class="GtkVBox" id="FontSize">
<widget class="GtkLabel" id="label36">
<property name="visible">True</property>
<property name="label" translatable="yes">_Sans Font:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">FontSans</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="FontSans">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
@ -444,6 +473,124 @@
</packing>
</child>
<child>
<widget class="GtkLabel" id="label37">
<property name="visible">True</property>
<property name="label" translatable="yes">_Typewriter Font:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">FontTypewriter</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="FontTypewriter">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label38">
<property name="visible">True</property>
<property name="label" translatable="yes">_Default Font Family:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">FontDefaultFamily</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">9</property>
<property name="bottom_attach">10</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="FontDefaultFamily">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">9</property>
<property name="bottom_attach">10</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="FontSize">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">10</property>
<property name="bottom_attach">11</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label34">
<property name="visible">True</property>
@ -466,8 +613,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">10</property>
<property name="bottom_attach">11</property>
<property name="top_attach">17</property>
<property name="bottom_attach">18</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -488,8 +635,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">10</property>
<property name="bottom_attach">11</property>
<property name="top_attach">17</property>
<property name="bottom_attach">18</property>
<property name="y_options"></property>
</packing>
</child>
@ -593,8 +740,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">11</property>
<property name="bottom_attach">12</property>
<property name="top_attach">18</property>
<property name="bottom_attach">19</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
@ -621,8 +768,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">11</property>
<property name="bottom_attach">12</property>
<property name="top_attach">18</property>
<property name="bottom_attach">19</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
@ -692,8 +839,8 @@
<packing>
<property name="left_attach">0</property>
<property name="right_attach">3</property>
<property name="top_attach">9</property>
<property name="bottom_attach">10</property>
<property name="top_attach">16</property>
<property name="bottom_attach">17</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -806,8 +953,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="top_attach">10</property>
<property name="bottom_attach">11</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -834,8 +981,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="top_attach">15</property>
<property name="bottom_attach">16</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -916,6 +1063,152 @@
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="scaleSansLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">S_cale Sans Serif %</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">scaleSansSB</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">11</property>
<property name="bottom_attach">12</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="scaleSansSB">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="climb_rate">1</property>
<property name="digits">0</property>
<property name="numeric">False</property>
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
<property name="adjustment">1 0 100 1 10 10</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">11</property>
<property name="bottom_attach">12</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="scaleTypewriterLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Sc_ale Typewriter %</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">scaleTypewriterSB</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">12</property>
<property name="bottom_attach">13</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="scaleTypewriterSB">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="climb_rate">1</property>
<property name="digits">0</property>
<property name="numeric">False</property>
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
<property name="adjustment">1 0 100 1 10 10</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">12</property>
<property name="bottom_attach">13</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="fontScCB">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Use true S_mall Caps</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">13</property>
<property name="bottom_attach">14</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="fontOsfCB">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Use _Old Style Figures</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">14</property>
<property name="bottom_attach">15</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>

View File

@ -4,6 +4,7 @@ UIFILES = \
BiblioModuleBase.ui \
BranchesModuleBase.ui \
BulletsModuleBase.ui \
FontModuleBase.ui \
TextLayoutModuleBase.ui \
LanguageModuleBase.ui \
LaTeXModuleBase.ui \

View File

@ -34,6 +34,7 @@
#include <qmultilineedit.h>
#include <qradiobutton.h>
#include <qcheckbox.h>
#include <qspinbox.h>
#include <qslider.h>
#include <qlineedit.h>
#include <qlistview.h>
@ -41,6 +42,7 @@
using lyx::support::bformat;
using lyx::support::findToken;
using lyx::support::getVectorFromString;
using std::distance;
@ -123,7 +125,7 @@ void QDocument::build_dialog()
dialog_->pageLayoutModule->paperwidthUnitCO->noPercents();
dialog_->pageLayoutModule->paperheightUnitCO->noPercents();
// layout
// text layout
for (LyXTextClassList::const_iterator cit = textclasslist.begin();
cit != textclasslist.end(); ++cit) {
if (cit->isTeXClassAvailable()) {
@ -135,16 +137,6 @@ void QDocument::build_dialog()
}
}
for (int n = 0; tex_fonts[n][0]; ++n) {
QString font = tex_fonts[n];
dialog_->textLayoutModule->fontsCO->insertItem(font);
}
dialog_->textLayoutModule->fontsizeCO->insertItem(qt_("default"));
dialog_->textLayoutModule->fontsizeCO->insertItem(qt_("10"));
dialog_->textLayoutModule->fontsizeCO->insertItem(qt_("11"));
dialog_->textLayoutModule->fontsizeCO->insertItem(qt_("12"));
dialog_->textLayoutModule->skipCO->insertItem(qt_("SmallSkip"));
dialog_->textLayoutModule->skipCO->insertItem(qt_("MedSkip"));
dialog_->textLayoutModule->skipCO->insertItem(qt_("BigSkip"));
@ -152,6 +144,36 @@ void QDocument::build_dialog()
// remove the %-items from the unit choice
dialog_->textLayoutModule->skipLengthCO->noPercents();
// fonts
for (int n = 0; tex_fonts_roman[n][0]; ++n) {
QString font = toqstr(tex_fonts_roman_gui[n]);
if (!controller().isFontAvailable(tex_fonts_roman[n]))
font += qt_(" (not installed)");
dialog_->fontModule->fontsRomanCO->insertItem(font);
}
for (int n = 0; tex_fonts_sans[n][0]; ++n) {
QString font = toqstr(tex_fonts_sans_gui[n]);
if (!controller().isFontAvailable(tex_fonts_sans[n]))
font += qt_(" (not installed)");
dialog_->fontModule->fontsSansCO->insertItem(font);
}
for (int n = 0; tex_fonts_monospaced[n][0]; ++n) {
QString font = toqstr(tex_fonts_monospaced_gui[n]);
if (!controller().isFontAvailable(tex_fonts_monospaced[n]))
font += qt_(" (not installed)");
dialog_->fontModule->fontsTypewriterCO->insertItem(font);
}
for (int n = 0; ControlDocument::fontfamilies_gui[n][0]; ++n)
dialog_->fontModule->fontsDefaultCO->insertItem(
qt_(ControlDocument::fontfamilies_gui[n]));
dialog_->fontModule->fontsizeCO->insertItem(qt_("default"));
dialog_->fontModule->fontsizeCO->insertItem(qt_("10"));
dialog_->fontModule->fontsizeCO->insertItem(qt_("11"));
dialog_->fontModule->fontsizeCO->insertItem(qt_("12"));
// page layout
dialog_->pageLayoutModule->pagestyleCO->insertItem(qt_("default"));
dialog_->pageLayoutModule->pagestyleCO->insertItem(qt_("empty"));
dialog_->pageLayoutModule->pagestyleCO->insertItem(qt_("plain"));
@ -295,12 +317,6 @@ void QDocument::apply()
params.textclass =
dialog_->latexModule->classCO->currentItem();
params.fonts =
fromqstr(dialog_->textLayoutModule->fontsCO->currentText());
params.fontsize =
fromqstr(dialog_->textLayoutModule->fontsizeCO->currentText());
params.pagestyle =
fromqstr(dialog_->pageLayoutModule->pagestyleCO->currentText());
@ -361,6 +377,34 @@ void QDocument::apply()
params.float_placement = dialog_->floatModule->get();
// fonts
params.fontsRoman =
tex_fonts_roman[dialog_->fontModule->fontsRomanCO->currentItem()];
params.fontsSans =
tex_fonts_sans[dialog_->fontModule->fontsSansCO->currentItem()];
params.fontsTypewriter =
tex_fonts_monospaced[dialog_->fontModule->fontsTypewriterCO->currentItem()];
params.fontsSansScale = dialog_->fontModule->scaleSansSB->value();
params.fontsTypewriterScale = dialog_->fontModule->scaleTypewriterSB->value();
params.fontsSC = dialog_->fontModule->fontScCB->isChecked();
params.fontsOSF = dialog_->fontModule->fontOsfCB->isChecked();
params.fontsDefaultFamily =
ControlDocument::fontfamilies[
dialog_->fontModule->fontsDefaultCO->currentItem()];
if (dialog_->fontModule->fontsizeCO->currentItem() == 0)
params.fontsize = "default";
else
params.fontsize =
fromqstr(dialog_->fontModule->fontsizeCO->currentText());
// paper
params.papersize = PAPER_SIZE(
dialog_->pageLayoutModule->papersizeCO->currentItem());
@ -551,22 +595,12 @@ void QDocument::update_contents()
case Spacing::Default: case Spacing::Single: nitem = 0; break;
}
// layout
// text layout
dialog_->latexModule->classCO->setCurrentItem(params.textclass);
dialog_->updateFontsize(controller().textClass().opt_fontsize(),
params.fontsize);
dialog_->updatePagestyle(controller().textClass().opt_pagestyle(),
params.pagestyle);
for (int n = 0; tex_fonts[n][0]; ++n) {
if (tex_fonts[n] == params.fonts) {
dialog_->textLayoutModule->fontsCO->setCurrentItem(n);
break;
}
}
dialog_->textLayoutModule->lspacingCO->setCurrentItem(nitem);
if (params.spacing().getSpace() == Spacing::Other) {
dialog_->textLayoutModule->lspacingLE->setText(
@ -620,26 +654,39 @@ void QDocument::update_contents()
dialog_->floatModule->set(params.float_placement);
// paper
int const psize = params.papersize;
dialog_->pageLayoutModule->papersizeCO->setCurrentItem(psize);
dialog_->setCustomPapersize(psize);
//fonts
dialog_->updateFontsize(controller().textClass().opt_fontsize(),
params.fontsize);
bool const landscape =
params.orientation == ORIENTATION_LANDSCAPE;
dialog_->pageLayoutModule->landscapeRB->setChecked(landscape);
dialog_->pageLayoutModule->portraitRB->setChecked(!landscape);
int n = findToken(tex_fonts_roman, params.fontsRoman);
if (n >= 0)
dialog_->fontModule->fontsRomanCO->setCurrentItem(n);
dialog_->pageLayoutModule->facingPagesCB->setChecked(
params.sides == LyXTextClass::TwoSides);
n = findToken(tex_fonts_sans, params.fontsSans);
if (n >= 0)
dialog_->fontModule->fontsSansCO->setCurrentItem(n);
n = findToken(tex_fonts_monospaced, params.fontsTypewriter);
if (n >= 0)
dialog_->fontModule->fontsTypewriterCO->setCurrentItem(n);
dialog_->fontModule->fontScCB->setChecked(params.fontsSC);
dialog_->fontModule->fontOsfCB->setChecked(params.fontsOSF);
dialog_->fontModule->fontScCB->setEnabled(
controller().providesSC(params.fontsRoman));
dialog_->fontModule->fontOsfCB->setEnabled(
controller().providesOSF(params.fontsRoman));
dialog_->fontModule->scaleSansSB->setValue(params.fontsSansScale);
dialog_->fontModule->scaleTypewriterSB->setValue(
params.fontsTypewriterScale);
dialog_->fontModule->scaleSansSB->setEnabled(
controller().providesScale(params.fontsSans));
dialog_->fontModule->scaleTypewriterSB->setEnabled(
controller().providesScale(params.fontsTypewriter));
lengthToWidgets(dialog_->pageLayoutModule->paperwidthLE,
dialog_->pageLayoutModule->paperwidthUnitCO, params.paperwidth, defaultUnit);
lengthToWidgets(dialog_->pageLayoutModule->paperheightLE,
dialog_->pageLayoutModule->paperheightUnitCO, params.paperheight, defaultUnit);
n = findToken(ControlDocument::fontfamilies, params.fontsDefaultFamily);
if (n >= 0)
dialog_->fontModule->fontsDefaultCO->setCurrentItem(n);
// margins
MarginsModuleBase * m = dialog_->marginsModule;

View File

@ -23,6 +23,7 @@
#include "bufferparams.h"
#include "gettext.h"
#include "lyxrc.h"
#include "tex-strings.h"
#include "controllers/ControlDocument.h"
@ -36,6 +37,7 @@
#include <qradiobutton.h>
#include <qcheckbox.h>
#include <qslider.h>
#include <qspinbox.h>
#include <qpixmap.h>
#include <qcolor.h>
#include <qcolordialog.h>
@ -61,6 +63,7 @@ QDocumentDialog::QDocumentDialog(QDocument * form)
connect(restorePB, SIGNAL(clicked()),
form, SLOT(slotRestore()));
fontModule = new FontModuleBase(this);
textLayoutModule = new TextLayoutModuleBase(this);
pageLayoutModule = new PageLayoutModuleBase(this);
marginsModule = new MarginsModuleBase(this);
@ -75,6 +78,7 @@ QDocumentDialog::QDocumentDialog(QDocument * form)
preambleModule = new PreambleModuleBase(this);
docPS->addPanel(latexModule, _("Document Class"));
docPS->addPanel(fontModule, _("Fonts"));
docPS->addPanel(textLayoutModule, _("Text Layout"));
docPS->addPanel(pageLayoutModule, _("Page Layout"));
docPS->addPanel(marginsModule, _("Page Margins"));
@ -118,8 +122,6 @@ QDocumentDialog::QDocumentDialog(QDocument * form)
connect(latexModule->psdriverCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(latexModule->classCO, SIGNAL(activated(int)), this, SLOT(classChanged()));
// text layout
connect(textLayoutModule->fontsCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(textLayoutModule->fontsizeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(textLayoutModule->lspacingCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(textLayoutModule->lspacingCO, SIGNAL(activated(int)), this, SLOT(setLSpacing(int)));
connect(textLayoutModule->lspacingLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
@ -132,6 +134,20 @@ QDocumentDialog::QDocumentDialog(QDocument * form)
connect(textLayoutModule->skipRB, SIGNAL(toggled(bool)), this, SLOT(enableSkip(bool)));
connect(textLayoutModule->twoColumnCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
// fonts
connect(fontModule->fontsRomanCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(fontModule->fontsRomanCO, SIGNAL(activated(int)), this, SLOT(romanChanged(int)));
connect(fontModule->fontsSansCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(fontModule->fontsSansCO, SIGNAL(activated(int)), this, SLOT(sansChanged(int)));
connect(fontModule->fontsTypewriterCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(fontModule->fontsTypewriterCO, SIGNAL(activated(int)), this, SLOT(ttChanged(int)));
connect(fontModule->fontsDefaultCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(fontModule->fontsizeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(fontModule->scaleSansSB, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
connect(fontModule->scaleTypewriterSB, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
connect(fontModule->fontScCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
connect(fontModule->fontOsfCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
// margins
connect(marginsModule->marginCB, SIGNAL(toggled(bool)), this, SLOT(setCustomMargins(bool)));
connect(marginsModule->marginCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
@ -321,22 +337,51 @@ void QDocumentDialog::setCustomMargins(bool custom)
void QDocumentDialog::updateFontsize(string const & items, string const & sel)
{
textLayoutModule->fontsizeCO->clear();
textLayoutModule->fontsizeCO->insertItem("default");
fontModule->fontsizeCO->clear();
fontModule->fontsizeCO->insertItem(qt_("default"));
for (int n = 0; !token(items,'|',n).empty(); ++n)
textLayoutModule->fontsizeCO->
fontModule->fontsizeCO->
insertItem(toqstr(token(items,'|',n)));
for (int n = 0; n<textLayoutModule->fontsizeCO->count(); ++n) {
if (fromqstr(textLayoutModule->fontsizeCO->text(n)) == sel) {
textLayoutModule->fontsizeCO->setCurrentItem(n);
for (int n = 0; n < fontModule->fontsizeCO->count(); ++n) {
if (fromqstr(fontModule->fontsizeCO->text(n)) == sel) {
fontModule->fontsizeCO->setCurrentItem(n);
break;
}
}
}
void QDocumentDialog::romanChanged(int item)
{
string const font = tex_fonts_roman[item];
fontModule->fontScCB->setEnabled(
form_->controller().providesSC(font));
fontModule->fontOsfCB->setEnabled(
form_->controller().providesOSF(font));
}
void QDocumentDialog::sansChanged(int item)
{
string const font = tex_fonts_sans[item];
fontModule->scaleSansSB->setEnabled(
form_->controller().providesScale(font));
}
void QDocumentDialog::ttChanged(int item)
{
string const font = tex_fonts_monospaced[item];
fontModule->scaleTypewriterSB->setEnabled(
form_->controller().providesScale(font));
}
void QDocumentDialog::updatePagestyle(string const & items, string const & sel)
{
pageLayoutModule->pagestyleCO->clear();

View File

@ -16,6 +16,7 @@
#include "BulletsModule.h"
#include "ui/FontModuleBase.h"
#include "ui/TextLayoutModuleBase.h"
#include "ui/MathsModuleBase.h"
#include "ui/LaTeXModuleBase.h"
@ -60,6 +61,9 @@ protected slots:
void setMargins(bool);
void setCustomPapersize(int);
void setCustomMargins(bool);
void romanChanged(int);
void sansChanged(int);
void ttChanged(int);
void setSkip(int);
void enableSkip(bool);
void portraitChanged();
@ -74,6 +78,7 @@ protected:
void closeEvent(QCloseEvent * e);
private:
FontModuleBase * fontModule;
TextLayoutModuleBase * textLayoutModule;
PageLayoutModuleBase * pageLayoutModule;
MarginsModuleBase * marginsModule;

View File

@ -0,0 +1,275 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>FontModuleBase</class>
<widget class="QWidget">
<property name="name">
<cstring>FontModuleBase</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>344</width>
<height>435</height>
</rect>
</property>
<property name="caption">
<string>FontModuleBase</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QGroupBox" row="0" column="0">
<property name="name">
<cstring>GroupBox3</cstring>
</property>
<property name="title">
<string>Document Fonts</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel" row="0" column="0">
<property name="name">
<cstring>fontsRomanLA</cstring>
</property>
<property name="text">
<string>&amp;Roman:</string>
</property>
<property name="buddy" stdset="0">
<cstring>fontsRomanCO</cstring>
</property>
</widget>
<widget class="QComboBox" row="0" column="1">
<property name="name">
<cstring>fontsRomanCO</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QLabel" row="1" column="0">
<property name="name">
<cstring>fontsSansLA</cstring>
</property>
<property name="text">
<string>&amp;Sans Serif:</string>
</property>
<property name="buddy" stdset="0">
<cstring>fontsRomanCO</cstring>
</property>
</widget>
<widget class="QComboBox" row="1" column="1">
<property name="name">
<cstring>fontsSansCO</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QComboBox" row="2" column="1">
<property name="name">
<cstring>fontsTypewriterCO</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QLabel" row="2" column="0">
<property name="name">
<cstring>fontsTypewriterLA</cstring>
</property>
<property name="text">
<string>&amp;Typewriter:</string>
</property>
<property name="buddy" stdset="0">
<cstring>fontsRomanCO</cstring>
</property>
</widget>
<widget class="QLabel" row="3" column="0">
<property name="name">
<cstring>fontsDefaultLA</cstring>
</property>
<property name="text">
<string>&amp;Default Family:</string>
</property>
<property name="buddy" stdset="0">
<cstring>fontsDefaultCO</cstring>
</property>
</widget>
<widget class="QComboBox" row="3" column="1">
<property name="name">
<cstring>fontsDefaultCO</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</grid>
</widget>
<spacer row="3" column="0">
<property name="name">
<cstring>Spacer3</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>60</height>
</size>
</property>
</spacer>
<widget class="QGroupBox" row="2" column="0">
<property name="name">
<cstring>fontAdvancedGB</cstring>
</property>
<property name="title">
<string>Advanced Options</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QCheckBox" row="0" column="0">
<property name="name">
<cstring>fontScCB</cstring>
</property>
<property name="text">
<string>Use true S&amp;mall Caps</string>
</property>
<property name="accel">
<string>Alt+M</string>
</property>
</widget>
<widget class="QCheckBox" row="1" column="0">
<property name="name">
<cstring>fontOsfCB</cstring>
</property>
<property name="text">
<string>Use &amp;Old Style Figures</string>
</property>
<property name="accel">
<string>Alt+O</string>
</property>
</widget>
</grid>
</widget>
<widget class="QGroupBox" row="1" column="0">
<property name="name">
<cstring>groupBox3</cstring>
</property>
<property name="title">
<string>Font Sizes</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QComboBox" row="0" column="1" rowspan="1" colspan="2">
<property name="name">
<cstring>fontsizeCO</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QSpinBox" row="1" column="2">
<property name="name">
<cstring>scaleSansSB</cstring>
</property>
<property name="maxValue">
<number>200</number>
</property>
<property name="minValue">
<number>10</number>
</property>
</widget>
<widget class="QLabel" row="0" column="0">
<property name="name">
<cstring>TextLabel2_2</cstring>
</property>
<property name="text">
<string>&amp;Base Size:</string>
</property>
<property name="buddy" stdset="0">
<cstring>fontsizeCO</cstring>
</property>
</widget>
<widget class="QLabel" row="1" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>scaleSansLA</cstring>
</property>
<property name="text">
<string>S&amp;cale Sans Serif %:</string>
</property>
<property name="buddy" stdset="0">
<cstring>scaleSansSB</cstring>
</property>
</widget>
<widget class="QLabel" row="2" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>scaleTypewriterLA</cstring>
</property>
<property name="text">
<string>Sc&amp;ale Typewriter %:</string>
</property>
<property name="buddy" stdset="0">
<cstring>scaleTypewriterSB</cstring>
</property>
</widget>
<widget class="QSpinBox" row="2" column="2">
<property name="name">
<cstring>scaleTypewriterSB</cstring>
</property>
<property name="maxValue">
<number>200</number>
</property>
<property name="minValue">
<number>10</number>
</property>
</widget>
</grid>
</widget>
</grid>
</widget>
<tabstops>
<tabstop>fontsRomanCO</tabstop>
<tabstop>fontsizeCO</tabstop>
</tabstops>
<includes>
<include location="global" impldecl="in implementation">config.h</include>
<include location="local" impldecl="in implementation">qt_helpers.h</include>
</includes>
<layoutdefaults spacing="6" margin="11"/>
</UI>

View File

@ -25,89 +25,6 @@
<property name="spacing">
<number>6</number>
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>Layout22</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<widget class="QGroupBox">
<property name="name">
<cstring>GroupBox3</cstring>
</property>
<property name="title">
<string>Document Font</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>11</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<widget class="QLabel" row="0" column="0">
<property name="name">
<cstring>TextLabel2</cstring>
</property>
<property name="text">
<string>&amp;Font:</string>
</property>
<property name="buddy" stdset="0">
<cstring>fontsCO</cstring>
</property>
</widget>
<widget class="QComboBox" row="1" column="1">
<property name="name">
<cstring>fontsizeCO</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QComboBox" row="0" column="1">
<property name="name">
<cstring>fontsCO</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QLabel" row="1" column="0">
<property name="name">
<cstring>TextLabel2_2</cstring>
</property>
<property name="text">
<string>&amp;Size:</string>
</property>
<property name="buddy" stdset="0">
<cstring>fontsizeCO</cstring>
</property>
</widget>
</grid>
</widget>
</hbox>
</widget>
<widget class="QButtonGroup">
<property name="name">
<cstring>ButtonGroup6</cstring>
@ -405,12 +322,10 @@
</customwidgets>
<images>
<image name="image0">
<data format="PNG" length="256">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000000c749444154388dad55db1184200c4c180bb81a28c73aad811228c356f42b3792db3cc0db2fc724bb7901dc7b270f27ed17fa5fa9b117b7cd90211f4ba0ac906a7f1453b4d30ca917bb590681552af23f69bfc4ffa71519d2c8f62546ea5ea03738b1c18c33a4d156f0d13f43b61952e4af6d6e8fb3a408f080448419a433d6486d85052fdba892a295f5d45785cd8c51a9d6de6a814a8d2131da51f98e7a3b64ec9da04a8db53d43be3c3c0b22cacf17e4cdb5a931649ceddf34b190cf0aa019f03f1fd3e7457f03b5a66c9ed26e86130000000049454e44ae426082</data>
<data format="PNG" length="256">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000000c749444154388dad55db1184200c4c180bb005eab1cd6b8112b40d4bf1bee2486ef3006fbf1c93ece605f07eece4e1a4ed42ff2b35f6e2961132e46309941952ed8f628a761a21f56217cb20b04a45fe276d97f8ffb422431ad96e62a4ee057a83131bcc38431a6d057f8eb5cb36438afcb5cded719614011e9088308374c61aa9adb0e0651b5552b4b29efaacb099312ad5da5b2d50a93124463b2adf516fbb8cbd1354a9b1b667c8a787674144f9f982bcb93635ba8cb3fd1b2616f251013403fee763fabce8bff0aa6c98500331e50000000049454e44ae426082</data>
</image>
</images>
<tabstops>
<tabstop>fontsCO</tabstop>
<tabstop>fontsizeCO</tabstop>
<tabstop>indentRB</tabstop>
<tabstop>skipRB</tabstop>
<tabstop>skipCO</tabstop>

View File

@ -4,6 +4,7 @@ UIFILES = \
BiblioUi.ui \
BranchesUi.ui \
BulletsUi.ui \
FontUi.ui \
TextLayoutUi.ui \
LanguageUi.ui \
LaTeXUi.ui \

View File

@ -45,6 +45,7 @@
using lyx::support::token;
using lyx::support::bformat;
using lyx::support::findToken;
using lyx::support::getVectorFromString;
using std::distance;
@ -96,8 +97,6 @@ QDocumentDialog::QDocumentDialog(QDocument * form)
textLayoutModule = new UiWidget<Ui::TextLayoutUi>;
// text layout
connect(textLayoutModule->fontsCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(textLayoutModule->fontsizeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(textLayoutModule->lspacingCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(textLayoutModule->lspacingCO, SIGNAL(activated(int)), this, SLOT(setLSpacing(int)));
connect(textLayoutModule->lspacingLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
@ -114,16 +113,6 @@ QDocumentDialog::QDocumentDialog(QDocument * form)
textLayoutModule->skipLE->setValidator(unsignedLengthValidator(
textLayoutModule->skipLE));
for (int n = 0; tex_fonts[n][0]; ++n) {
QString font = tex_fonts[n];
textLayoutModule->fontsCO->insertItem(font);
}
textLayoutModule->fontsizeCO->insertItem(qt_("default"));
textLayoutModule->fontsizeCO->insertItem(qt_("10"));
textLayoutModule->fontsizeCO->insertItem(qt_("11"));
textLayoutModule->fontsizeCO->insertItem(qt_("12"));
textLayoutModule->skipCO->insertItem(qt_("SmallSkip"));
textLayoutModule->skipCO->insertItem(qt_("MedSkip"));
textLayoutModule->skipCO->insertItem(qt_("BigSkip"));
@ -145,6 +134,52 @@ QDocumentDialog::QDocumentDialog(QDocument * form)
fontModule = new UiWidget<Ui::FontUi>;
// fonts
connect(fontModule->fontsRomanCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(fontModule->fontsRomanCO, SIGNAL(activated(int)), this, SLOT(romanChanged(int)));
connect(fontModule->fontsSansCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(fontModule->fontsSansCO, SIGNAL(activated(int)), this, SLOT(sansChanged(int)));
connect(fontModule->fontsTypewriterCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(fontModule->fontsTypewriterCO, SIGNAL(activated(int)), this, SLOT(ttChanged(int)));
connect(fontModule->fontsDefaultCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(fontModule->fontsizeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(fontModule->scaleSansSB, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
connect(fontModule->scaleTypewriterSB, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
connect(fontModule->fontScCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
connect(fontModule->fontOsfCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
for (int n = 0; tex_fonts_roman[n][0]; ++n) {
QString font = toqstr(tex_fonts_roman_gui[n]);
if (!form_->controller().isFontAvailable(tex_fonts_roman[n]))
font += qt_(" (not installed)");
fontModule->fontsRomanCO->insertItem(font);
}
for (int n = 0; tex_fonts_sans[n][0]; ++n) {
QString font = toqstr(tex_fonts_sans_gui[n]);
if (!form_->controller().isFontAvailable(tex_fonts_sans[n]))
font += qt_(" (not installed)");
fontModule->fontsSansCO->insertItem(font);
}
for (int n = 0; tex_fonts_monospaced[n][0]; ++n) {
QString font = toqstr(tex_fonts_monospaced_gui[n]);
if (!form_->controller().isFontAvailable(tex_fonts_monospaced[n]))
font += qt_(" (not installed)");
fontModule->fontsTypewriterCO->insertItem(font);
}
fontModule->fontsizeCO->insertItem(qt_("default"));
fontModule->fontsizeCO->insertItem(qt_("10"));
fontModule->fontsizeCO->insertItem(qt_("11"));
fontModule->fontsizeCO->insertItem(qt_("12"));
for (int n = 0; ControlDocument::fontfamilies_gui[n][0]; ++n)
fontModule->fontsDefaultCO->insertItem(
qt_(ControlDocument::fontfamilies_gui[n]));
pageLayoutModule = new UiWidget<Ui::PageLayoutUi>;
// page layout
connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)), this, SLOT(setCustomPapersize(int)));
@ -357,6 +392,7 @@ QDocumentDialog::QDocumentDialog(QDocument * form)
connect(floatModule, SIGNAL(changed()), this, SLOT(change_adaptor()));
docPS->addPanel(latexModule, _("Document Class"));
docPS->addPanel(fontModule, _("Fonts"));
docPS->addPanel(textLayoutModule, _("Text Layout"));
docPS->addPanel(pageLayoutModule, _("Page Layout"));
docPS->addPanel(marginsModule, _("Page Margins"));
@ -491,22 +527,51 @@ void QDocumentDialog::setCustomMargins(bool custom)
void QDocumentDialog::updateFontsize(string const & items, string const & sel)
{
textLayoutModule->fontsizeCO->clear();
textLayoutModule->fontsizeCO->insertItem("default");
fontModule->fontsizeCO->clear();
fontModule->fontsizeCO->insertItem(qt_("default"));
for (int n = 0; !token(items,'|',n).empty(); ++n)
textLayoutModule->fontsizeCO->
fontModule->fontsizeCO->
insertItem(toqstr(token(items,'|',n)));
for (int n = 0; n<textLayoutModule->fontsizeCO->count(); ++n) {
if (fromqstr(textLayoutModule->fontsizeCO->text(n)) == sel) {
textLayoutModule->fontsizeCO->setCurrentItem(n);
for (int n = 0; n < fontModule->fontsizeCO->count(); ++n) {
if (fromqstr(fontModule->fontsizeCO->text(n)) == sel) {
fontModule->fontsizeCO->setCurrentItem(n);
break;
}
}
}
void QDocumentDialog::romanChanged(int item)
{
string const font = tex_fonts_roman[item];
fontModule->fontScCB->setEnabled(
form_->controller().providesSC(font));
fontModule->fontOsfCB->setEnabled(
form_->controller().providesOSF(font));
}
void QDocumentDialog::sansChanged(int item)
{
string const font = tex_fonts_sans[item];
fontModule->scaleSansSB->setEnabled(
form_->controller().providesScale(font));
}
void QDocumentDialog::ttChanged(int item)
{
string const font = tex_fonts_monospaced[item];
fontModule->scaleTypewriterSB->setEnabled(
form_->controller().providesScale(font));
}
void QDocumentDialog::updatePagestyle(string const & items, string const & sel)
{
pageLayoutModule->pagestyleCO->clear();
@ -658,16 +723,10 @@ void QDocumentDialog::apply(BufferParams & params)
params.use_amsmath = BufferParams::AMS_OFF;
}
// layout
// text layout
params.textclass =
latexModule->classCO->currentItem();
params.fonts =
fromqstr(textLayoutModule->fontsCO->currentText());
params.fontsize =
fromqstr(textLayoutModule->fontsizeCO->currentText());
params.pagestyle =
fromqstr(pageLayoutModule->pagestyleCO->currentText());
@ -728,6 +787,33 @@ void QDocumentDialog::apply(BufferParams & params)
params.float_placement = floatModule->get();
// fonts
params.fontsRoman =
tex_fonts_roman[fontModule->fontsRomanCO->currentItem()];
params.fontsSans =
tex_fonts_sans[fontModule->fontsSansCO->currentItem()];
params.fontsTypewriter =
tex_fonts_monospaced[fontModule->fontsTypewriterCO->currentItem()];
params.fontsSansScale = fontModule->scaleSansSB->value();
params.fontsTypewriterScale = fontModule->scaleTypewriterSB->value();
params.fontsSC = fontModule->fontScCB->isChecked();
params.fontsOSF = fontModule->fontOsfCB->isChecked();
params.fontsDefaultFamily = ControlDocument::fontfamilies[
fontModule->fontsDefaultCO->currentItem()];
if (fontModule->fontsizeCO->currentItem() == 0)
params.fontsize = "default";
else
params.fontsize =
fromqstr(fontModule->fontsizeCO->currentText());
// paper
params.papersize = PAPER_SIZE(
pageLayoutModule->papersizeCO->currentItem());
@ -912,22 +998,12 @@ void QDocumentDialog::update(BufferParams const & params)
case Spacing::Default: case Spacing::Single: nitem = 0; break;
}
// layout
// text layout
latexModule->classCO->setCurrentItem(params.textclass);
updateFontsize(form_->controller().textClass().opt_fontsize(),
params.fontsize);
updatePagestyle(form_->controller().textClass().opt_pagestyle(),
params.pagestyle);
for (int n = 0; tex_fonts[n][0]; ++n) {
if (tex_fonts[n] == params.fonts) {
textLayoutModule->fontsCO->setCurrentItem(n);
break;
}
}
textLayoutModule->lspacingCO->setCurrentItem(nitem);
if (params.spacing().getSpace() == Spacing::Other) {
textLayoutModule->lspacingLE->setText(
@ -981,6 +1057,39 @@ void QDocumentDialog::update(BufferParams const & params)
floatModule->set(params.float_placement);
//fonts
updateFontsize(form_->controller().textClass().opt_fontsize(),
params.fontsize);
int n = findToken(tex_fonts_roman, params.fontsRoman);
if (n >= 0)
fontModule->fontsRomanCO->setCurrentItem(n);
n = findToken(tex_fonts_sans, params.fontsSans);
if (n >= 0)
fontModule->fontsSansCO->setCurrentItem(n);
n = findToken(tex_fonts_monospaced, params.fontsTypewriter);
if (n >= 0)
fontModule->fontsTypewriterCO->setCurrentItem(n);
fontModule->fontScCB->setChecked(params.fontsSC);
fontModule->fontOsfCB->setChecked(params.fontsOSF);
fontModule->fontScCB->setEnabled(
form_->controller().providesSC(params.fontsRoman));
fontModule->fontOsfCB->setEnabled(
form_->controller().providesOSF(params.fontsRoman));
fontModule->scaleSansSB->setValue(params.fontsSansScale);
fontModule->scaleTypewriterSB->setValue(
params.fontsTypewriterScale);
fontModule->scaleSansSB->setEnabled(
form_->controller().providesScale(params.fontsSans));
fontModule->scaleTypewriterSB->setEnabled(
form_->controller().providesScale(params.fontsTypewriter));
n = findToken(ControlDocument::fontfamilies, params.fontsDefaultFamily);
if (n >= 0)
fontModule->fontsDefaultCO->setCurrentItem(n);
// paper
int const psize = params.papersize;
pageLayoutModule->papersizeCO->setCurrentItem(psize);

View File

@ -14,6 +14,7 @@
#define QDOCUMENTDIALOG_H
#include "ui/QDocumentUi.h"
#include "ui/FontUi.h"
#include "ui/TextLayoutUi.h"
#include "ui/MathsUi.h"
#include "ui/LaTeXUi.h"
@ -77,6 +78,9 @@ protected slots:
void setMargins(bool);
void setCustomPapersize(int);
void setCustomMargins(bool);
void romanChanged(int);
void sansChanged(int);
void ttChanged(int);
void setSkip(int);
void enableSkip(bool);
void portraitChanged();
@ -88,6 +92,7 @@ protected:
private:
UiWidget<Ui::TextLayoutUi> *textLayoutModule;
UiWidget<Ui::FontUi> *fontModule;
UiWidget<Ui::PageLayoutUi> *pageLayoutModule;
UiWidget<Ui::MarginsUi> *marginsModule;
UiWidget<Ui::LanguageUi> *langModule;

View File

@ -0,0 +1,266 @@
<ui version="4.0" >
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>FontUi</class>
<widget class="QWidget" name="FontUi" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>344</width>
<height>394</height>
</rect>
</property>
<property name="windowTitle" >
<string>FontUi</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="3" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>326</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0" >
<widget class="QGroupBox" name="fontAdvancedGB" >
<property name="title" >
<string>Advanced Options</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QCheckBox" name="fontScCB" >
<property name="text" >
<string>Use true S&amp;mall Caps</string>
</property>
<property name="shortcut" >
<string>Alt+M</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QCheckBox" name="fontOsfCB" >
<property name="text" >
<string>Use &amp;Old Style Figures</string>
</property>
<property name="shortcut" >
<string>Alt+O</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0" >
<widget class="QGroupBox" name="fontSizesGB" >
<property name="title" >
<string>Sizes</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="1" colspan="2" >
<widget class="QComboBox" name="fontsizeCO" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="TextLabel2_2" >
<property name="text" >
<string>&amp;Base Size:</string>
</property>
<property name="buddy" >
<cstring>fontsizeCO</cstring>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2" >
<widget class="QLabel" name="scaleTypewriterLA" >
<property name="text" >
<string>Sc&amp;ale Typewriter %:</string>
</property>
<property name="buddy" >
<cstring>scaleTypewriterSB</cstring>
</property>
</widget>
</item>
<item rowspan="2" row="2" column="2" >
<widget class="QSpinBox" name="scaleTypewriterSB" >
<property name="maximum" >
<number>200</number>
</property>
<property name="minimum" >
<number>10</number>
</property>
</widget>
</item>
<item row="1" column="2" >
<widget class="QSpinBox" name="scaleSansSB" >
<property name="maximum" >
<number>200</number>
</property>
<property name="minimum" >
<number>10</number>
</property>
</widget>
</item>
<item rowspan="2" row="1" column="0" colspan="2" >
<widget class="QLabel" name="scaleSansLA" >
<property name="text" >
<string>S&amp;cale Sans Serif %:</string>
</property>
<property name="buddy" >
<cstring>scaleSansSB</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0" >
<widget class="QGroupBox" name="fontsGB" >
<property name="title" >
<string>Families</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="1" >
<widget class="QComboBox" name="fontsRomanCO" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QComboBox" name="fontsSansCO" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="QComboBox" name="fontsDefaultCO" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QComboBox" name="fontsTypewriterCO" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="fontsDefaultLA" >
<property name="text" >
<string>&amp;Default Family:</string>
</property>
<property name="buddy" >
<cstring>fontsDefaultCO</cstring>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="fontsTypewriterLA" >
<property name="text" >
<string>&amp;Typewriter:</string>
</property>
<property name="buddy" >
<cstring>fontsRomanCO</cstring>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="fontsSansLA" >
<property name="text" >
<string>&amp;Sans Serif:</string>
</property>
<property name="buddy" >
<cstring>fontsRomanCO</cstring>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="fontsRomanLA" >
<property name="text" >
<string>&amp;Roman:</string>
</property>
<property name="buddy" >
<cstring>fontsRomanCO</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<tabstops>
<tabstop>fontsRomanCO</tabstop>
<tabstop>fontsizeCO</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@ -22,75 +22,6 @@
<property name="spacing" >
<number>6</number>
</property>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QGroupBox" name="GroupBox3" >
<property name="title" >
<string>Document Font</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>11</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QLabel" name="TextLabel2" >
<property name="text" >
<string>&amp;Font:</string>
</property>
<property name="buddy" >
<cstring>fontsCO</cstring>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QComboBox" name="fontsizeCO" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QComboBox" name="fontsCO" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="TextLabel2_2" >
<property name="text" >
<string>&amp;Size:</string>
</property>
<property name="buddy" >
<cstring>fontsizeCO</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="ButtonGroup6" >
<property name="title" >
@ -326,8 +257,6 @@
</customwidget>
</customwidgets>
<tabstops>
<tabstop>fontsCO</tabstop>
<tabstop>fontsizeCO</tabstop>
<tabstop>indentRB</tabstop>
<tabstop>skipRB</tabstop>
<tabstop>skipCO</tabstop>

View File

@ -1,4 +1,5 @@
uic BranchesUi.ui -o BranchesUi.h
uic FontUi.ui -o FontUi.h
uic LaTeXUi.ui -o LaTeXUi.h
uic MathsUi.ui -o MathsUi.h
uic PageLayoutUi.ui -o PageLayoutUi.h

View File

@ -60,6 +60,7 @@ namespace lyx {
using support::bformat;
using support::contains;
using lyx::support::findToken;
using support::getStringFromVector;
using support::getVectorFromString;
using support::libFileSearch;
@ -131,8 +132,6 @@ void FormDocument::build()
bcview().addReadOnly(class_->radio_indent);
bcview().addReadOnly(class_->radio_skip);
bcview().addReadOnly(class_->choice_pagestyle);
bcview().addReadOnly(class_->choice_fonts);
bcview().addReadOnly(class_->choice_fontsize);
bcview().addReadOnly(class_->radio_sides_one);
bcview().addReadOnly(class_->radio_sides_two);
bcview().addReadOnly(class_->radio_columns_one);
@ -174,10 +173,6 @@ void FormDocument::build()
fl_addto_choice(class_->choice_spacing,
_(" Single | OneHalf | Double | Custom ").c_str());
fl_addto_choice(class_->choice_fontsize, "default|10|11|12");
for (int n = 0; tex_fonts[n][0]; ++n) {
fl_addto_choice(class_->choice_fonts,tex_fonts[n]);
}
// Create the contents of the unit choices; don't include the
// "%" terms...
@ -205,6 +200,48 @@ void FormDocument::build()
bcview().addReadOnly(dialog_->button_save_defaults);
bcview().addReadOnly(dialog_->button_reset_defaults);
// the fonts form
font_.reset(build_document_font(this));
// disable for read-only documents
bcview().addReadOnly(font_->choice_fonts_roman);
bcview().addReadOnly(font_->choice_fontsize);
bcview().addReadOnly(font_->choice_fonts_sans);
bcview().addReadOnly(font_->choice_fonts_typewriter);
bcview().addReadOnly(font_->choice_fonts_defaultfamily);
bcview().addReadOnly(font_->counter_sf_scale);
bcview().addReadOnly(font_->counter_tt_scale);
bcview().addReadOnly(font_->check_use_sc);
bcview().addReadOnly(font_->check_use_osf);
fl_addto_choice(font_->choice_fontsize, "default|10|11|12");
for (int n = 0; tex_fonts_roman[n][0]; ++n) {
string font = tex_fonts_roman_gui[n];
if (!controller().isFontAvailable(tex_fonts_roman[n]))
font += _(" (not installed)");
fl_addto_choice(font_->choice_fonts_roman,font.c_str());
}
for (int n = 0; tex_fonts_sans[n][0]; ++n) {
string font = tex_fonts_sans_gui[n];
if (!controller().isFontAvailable(tex_fonts_sans[n]))
font += _(" (not installed)");
fl_addto_choice(font_->choice_fonts_sans,font.c_str());
}
for (int n = 0; tex_fonts_monospaced[n][0]; ++n) {
string font = tex_fonts_monospaced_gui[n];
if (!controller().isFontAvailable(tex_fonts_monospaced[n]))
font += _(" (not installed)");
fl_addto_choice(font_->choice_fonts_typewriter,font.c_str());
}
for (int n = 0; ControlDocument::fontfamilies_gui[n][0]; ++n)
fl_addto_choice(font_->choice_fonts_defaultfamily,
_(ControlDocument::fontfamilies_gui[n]).c_str());
fl_set_counter_bounds(font_->counter_sf_scale, 10, 200);
fl_set_counter_bounds(font_->counter_tt_scale, 10, 200);
// the document paper form
paper_.reset(build_document_paper(this));
@ -314,7 +351,7 @@ void FormDocument::build()
_(" Basic | Natbib author-year | Natbib numerical | Jurabib ");
fl_addto_choice(options_->choice_cite_engine, cite_choices.c_str());
// set up the tooltips for optionss form
// set up the tooltips for options form
string str = _("Natbib is used often for natural sciences and arts\n"
"Jurabib is more common in law and humanities");
tooltips().init(options_->choice_cite_engine, str);
@ -416,6 +453,8 @@ void FormDocument::build()
// Stack tabs
fl_addto_tabfolder(dialog_->tabfolder,_("Document").c_str(),
class_->form);
fl_addto_tabfolder(dialog_->tabfolder,_("Fonts").c_str(),
font_->form);
fl_addto_tabfolder(dialog_->tabfolder,_("Paper").c_str(),
paper_->form);
fl_addto_tabfolder(dialog_->tabfolder,_("Language").c_str(),
@ -443,6 +482,7 @@ void FormDocument::apply()
BufferParams & params = controller().params();
class_apply(params);
font_apply(params);
paper_apply(params);
language_apply(params);
options_apply(params);
@ -461,6 +501,7 @@ void FormDocument::update()
BufferParams const & params = controller().params();
class_update(params);
font_update(params);
paper_update(params);
language_update(params);
options_update(params);
@ -541,6 +582,29 @@ ButtonPolicy::SMInput FormDocument::input(FL_OBJECT * ob, long)
params.useClassDefaults();
UpdateLayoutDocument(params);
} else if (ob == font_->choice_fonts_roman) {
string const font =
tex_fonts_roman[fl_get_choice(
font_->choice_fonts_roman) - 1];
setEnabled(font_->check_use_sc,
controller().providesSC(font));
setEnabled(font_->check_use_osf,
controller().providesOSF(font));
} else if (ob == font_->choice_fonts_sans) {
string const font =
tex_fonts_sans[fl_get_choice(
font_->choice_fonts_sans) - 1];
setEnabled(font_->counter_sf_scale,
controller().providesScale(font));
} else if (ob == font_->choice_fonts_typewriter) {
string const font =
tex_fonts_monospaced[fl_get_choice(
font_->choice_fonts_typewriter) - 1];
setEnabled(font_->counter_tt_scale,
controller().providesScale(font));
} else if (ob == paper_->choice_papersize) {
int const paperchoice = fl_get_choice(paper_->choice_papersize);
bool const defsize = paperchoice == 1;
@ -781,8 +845,6 @@ bool FormDocument::class_apply(BufferParams &params)
getString(class_->input_skip).empty()) {
fl_set_choice(class_->choice_skip, 2);
}
params.fonts = getString(class_->choice_fonts);
params.fontsize = getString(class_->choice_fontsize);
params.pagestyle = getString(class_->choice_pagestyle);
params.textclass = fl_get_combox(class_->combox_class) - 1;
@ -861,6 +923,33 @@ bool FormDocument::class_apply(BufferParams &params)
}
void FormDocument::font_apply(BufferParams & params)
{
params.fontsRoman =
tex_fonts_roman[fl_get_choice(font_->choice_fonts_roman) - 1];
params.fontsSans =
tex_fonts_sans[fl_get_choice(font_->choice_fonts_sans) - 1];
params.fontsTypewriter =
tex_fonts_monospaced[fl_get_choice(font_->choice_fonts_typewriter) - 1];
params.fontsSansScale = int(fl_get_counter_value(font_->counter_sf_scale));
params.fontsTypewriterScale = int(fl_get_counter_value(font_->counter_tt_scale));
params.fontsSC = fl_get_button(font_->check_use_sc);
params.fontsOSF = fl_get_button(font_->check_use_osf);
params.fontsDefaultFamily = ControlDocument::fontfamilies[
fl_get_choice(font_->choice_fonts_defaultfamily) - 1];
params.fontsize =
params.fontsize = getString(font_->choice_fontsize);
}
void FormDocument::paper_apply(BufferParams & params)
{
params.papersize = PAPER_SIZE(fl_get_choice(paper_->choice_papersize) - 1);
@ -1009,11 +1098,11 @@ void FormDocument::UpdateClassParams(BufferParams const & params)
LyXTextClass const & tclass = params.getLyXTextClass();
fl_set_combox(class_->combox_class, params.textclass + 1);
fl_clear_choice(class_->choice_fontsize);
fl_addto_choice(class_->choice_fontsize, "default");
fl_addto_choice(class_->choice_fontsize,
fl_clear_choice(font_->choice_fontsize);
fl_addto_choice(font_->choice_fontsize, "default");
fl_addto_choice(font_->choice_fontsize,
tclass.opt_fontsize().c_str());
fl_set_choice_text(class_->choice_fontsize,
fl_set_choice_text(font_->choice_fontsize,
params.fontsize.c_str());
fl_clear_choice(class_->choice_pagestyle);
fl_addto_choice(class_->choice_pagestyle, "default");
@ -1034,8 +1123,6 @@ void FormDocument::class_update(BufferParams const & params)
UpdateClassParams(params);
fl_set_choice_text(class_->choice_fonts, params.fonts.c_str());
bool const indent = params.paragraph_separation == BufferParams::PARSEP_INDENT;
fl_set_button(class_->radio_indent, indent);
fl_set_button(class_->radio_skip, !indent);
@ -1115,6 +1202,43 @@ void FormDocument::class_update(BufferParams const & params)
}
void FormDocument::font_update(BufferParams const & params)
{
if (!font_.get())
return;
int n = findToken(tex_fonts_roman, params.fontsRoman);
if (n >= 0)
fl_set_choice(font_->choice_fonts_roman, n + 1);
n = findToken(tex_fonts_sans, params.fontsSans);
if (n >= 0)
fl_set_choice(font_->choice_fonts_sans, n + 1);
n = findToken(tex_fonts_monospaced, params.fontsTypewriter);
if (n >= 0)
fl_set_choice(font_->choice_fonts_typewriter, n + 1);
fl_set_button(font_->check_use_sc, params.fontsSC);
fl_set_button(font_->check_use_osf, params.fontsOSF);
setEnabled(font_->check_use_sc,
controller().providesSC(params.fontsRoman));
setEnabled(font_->check_use_osf,
controller().providesOSF(params.fontsRoman));
fl_set_counter_value(font_->counter_sf_scale, params.fontsSansScale);
fl_set_counter_value(font_->counter_tt_scale,
params.fontsTypewriterScale);
setEnabled(font_->counter_sf_scale,
controller().providesScale(params.fontsSans));
setEnabled(font_->counter_tt_scale,
controller().providesScale(params.fontsTypewriter));
n = findToken(ControlDocument::fontfamilies, params.fontsDefaultFamily);
if (n >= 0)
fl_set_choice(font_->choice_fonts_defaultfamily, n + 1);
}
void FormDocument::language_update(BufferParams const & params)
{
if (!language_.get())
@ -1485,6 +1609,7 @@ void FormDocument::UpdateLayoutDocument(BufferParams const & params)
checkReadOnly();
class_update(params);
font_update(params);
paper_update(params);
language_update(params);
options_update(params);

View File

@ -29,6 +29,7 @@ class ControlDocument;
class FormColorpicker;
struct FD_document;
struct FD_document_paper;
struct FD_document_font;
struct FD_document_class;
struct FD_document_language;
struct FD_document_options;
@ -81,6 +82,8 @@ private:
///
void class_update(BufferParams const &);
///
void font_update(BufferParams const &);
///
void language_update(BufferParams const &);
///
void options_update(BufferParams const &);
@ -94,6 +97,8 @@ private:
///
bool class_apply(BufferParams &);
///
void font_apply(BufferParams &);
///
bool language_apply(BufferParams &);
///
void options_apply(BufferParams &);
@ -110,6 +115,8 @@ private:
///
boost::scoped_ptr<FD_document_class> class_;
///
boost::scoped_ptr<FD_document_font> font_;
///
boost::scoped_ptr<FD_document_language> language_;
///
boost::scoped_ptr<FD_document_options> options_;

View File

@ -3,7 +3,7 @@ Magic: 13000
Internal Form Definition File
(do not change)
Number of forms: 7
Number of forms: 8
Unit of measure: FL_COORD_PIXEL
SnapGrid: 5
@ -688,13 +688,13 @@ argument: 0
=============== FORM ===============
Name: form_document_class
Width: 395
Height: 310
Number of Objects: 26
Height: 305
Number of Objects: 24
--------------------
class: FL_BOX
type: FLAT_BOX
box: 0 0 395 310
box: 0 0 395 305
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -730,7 +730,7 @@ argument:
--------------------
class: FL_LABELFRAME
type: ENGRAVED_FRAME
box: 5 225 385 80
box: 5 210 385 80
boxtype: FL_NO_BOX
colors: FL_BLACK FL_COL1
alignment: FL_ALIGN_TOP_LEFT
@ -763,42 +763,6 @@ name:
callback:
argument:
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
box: 110 80 160 25
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Fonts:|#F
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: choice_fonts
callback: C_FormDialogView_InputCB
argument: 0
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
box: 110 115 160 25
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Font Size:|#O
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: choice_fontsize
callback: C_FormDialogView_InputCB
argument: 0
--------------------
class: FL_CHOICE
type: DROPLIST_CHOICE
@ -838,7 +802,7 @@ argument: 0
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
box: 110 185 160 25
box: 110 170 160 25
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
@ -856,7 +820,7 @@ argument: 0
--------------------
class: FL_INPUT
type: NORMAL_INPUT
box: 110 150 160 25
box: 110 80 160 25
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
@ -874,7 +838,7 @@ argument: 0
--------------------
class: FL_INPUT
type: NORMAL_INPUT
box: 250 270 65 25
box: 245 255 65 25
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
@ -892,7 +856,7 @@ argument: 0
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
box: 115 270 125 25
box: 110 255 125 25
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_TOP
@ -1072,7 +1036,7 @@ argument:
--------------------
class: FL_ROUND3DBUTTON
type: RADIO_BUTTON
box: 25 240 100 25
box: 20 225 100 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
@ -1090,7 +1054,7 @@ argument: 0
--------------------
class: FL_ROUND3DBUTTON
type: RADIO_BUTTON
box: 25 270 100 25
box: 20 255 100 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
@ -1127,7 +1091,7 @@ argument:
--------------------
class: FL_INPUT
type: NORMAL_INPUT
box: 275 185 115 25
box: 275 170 115 25
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
@ -1145,7 +1109,7 @@ argument: 0
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
box: 315 270 50 25
box: 310 255 50 25
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
@ -1932,5 +1896,253 @@ name: button_modify
callback: C_FormDialogView_InputCB
argument: 0
=============== FORM ===============
Name: form_document_font
Width: 395
Height: 365
Number of Objects: 13
--------------------
class: FL_BOX
type: UP_BOX
box: 0 0 395 365
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name:
callback:
argument:
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
box: 205 25 160 25
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Roman:|#R
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: choice_fonts_roman
callback: C_FormDialogView_InputCB
argument: 0
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
box: 205 170 160 25
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Base Size:|#B
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: choice_fontsize
callback: C_FormDialogView_InputCB
argument: 0
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
box: 205 55 160 25
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Sans Serif:|#S
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: choice_fonts_sans
callback: C_FormDialogView_InputCB
argument: 0
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
box: 205 85 160 25
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Typewriter:|#T
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: choice_fonts_typewriter
callback: C_FormDialogView_InputCB
argument: 0
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
box: 205 115 160 25
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Default Family:|#F
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: choice_fonts_defaultfamily
callback: C_FormDialogView_InputCB
argument: 0
--------------------
class: FL_LABELFRAME
type: ENGRAVED_FRAME
box: 25 15 355 135
boxtype: FL_NO_BOX
colors: FL_BLACK FL_COL1
alignment: FL_ALIGN_TOP_LEFT
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: Fonts
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name:
callback:
argument:
--------------------
class: FL_COUNTER
type: SIMPLE_COUNTER
box: 265 200 100 25
boxtype: FL_UP_BOX
colors: FL_COL1 FL_BLUE
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Scale Sans Serif %:|#c:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: counter_sf_scale
callback: C_FormDialogView_InputCB
argument: 0
bounds: -2 5
precision: 0
value: 1
sstep: 1
--------------------
class: FL_COUNTER
type: SIMPLE_COUNTER
box: 265 230 100 25
boxtype: FL_UP_BOX
colors: FL_COL1 FL_BLUE
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Scale Typewriter %:|#y
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: counter_tt_scale
callback: C_FormDialogView_InputCB
argument: 0
bounds: -2 5
precision: 0
value: 1
sstep: 1
--------------------
class: FL_LABELFRAME
type: ENGRAVED_FRAME
box: 25 160 355 100
boxtype: FL_NO_BOX
colors: FL_BLACK FL_COL1
alignment: FL_ALIGN_TOP_LEFT
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: Sizes
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name:
callback:
argument:
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 340 280 25 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Use True Small Caps|#m
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: check_use_sc
callback: C_FormDialogView_InputCB
argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 340 310 25 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Use Old Style Figures|#O
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: check_use_osf
callback: C_FormDialogView_InputCB
argument: 0
--------------------
class: FL_LABELFRAME
type: ENGRAVED_FRAME
box: 25 270 355 75
boxtype: FL_NO_BOX
colors: FL_BLACK FL_COL1
alignment: FL_ALIGN_TOP_LEFT
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: Advanced Options
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name:
callback:
argument:
==============================
create_the_forms

View File

@ -378,7 +378,7 @@ LyXFont const Paragraph::getFont(BufferParams const & bparams, pos_type pos,
LyXFont font = getFontSettings(bparams, pos);
font.realize(layoutfont);
font.realize(outerfont);
font.realize(bparams.getLyXTextClass().defaultfont());
font.realize(bparams.getFont());
return font;
}
@ -390,7 +390,7 @@ LyXFont const Paragraph::getLabelFont
LyXFont tmpfont = layout()->labelfont;
tmpfont.setLanguage(getParLanguage(bparams));
tmpfont.realize(outerfont);
tmpfont.realize(bparams.getLyXTextClass().defaultfont());
tmpfont.realize(bparams.getFont());
return tmpfont;
}
@ -401,7 +401,7 @@ LyXFont const Paragraph::getLayoutFont
LyXFont tmpfont = layout()->font;
tmpfont.setLanguage(getParLanguage(bparams));
tmpfont.realize(outerfont);
tmpfont.realize(bparams.getLyXTextClass().defaultfont());
tmpfont.realize(bparams.getFont());
return tmpfont;
}

View File

@ -12,6 +12,7 @@
#include <config.h>
#include "tex-strings.h"
#include "gettext.h"
// this file should perhaps be split into even smaller parts
@ -52,8 +53,37 @@ char const * const string_align[] = {
// 27 times in the object file. (Asger)
char const * const tex_graphics[] = {"default", "dvips", "dvitops", "emtex",
"ln", "oztex", "textures", "none", ""};
"ln", "oztex", "textures", "none", ""
};
char const * const tex_fonts[] = {"default", "ae", "pslatex", "times", "palatino",
"helvet", "avant", "newcent", "bookman", ""};
char const * const tex_fonts_roman[] = {"default", "cmr", "lmodern", "ae", "times", "palatino",
"charter", "newcent", "bookman", "utopia", "beraserif", "ccfonts", "chancery", ""
};
char const * tex_fonts_roman_gui[] = { N_("Default"), N_("Computer Modern Roman"), N_("Latin Modern Roman"),
N_("AE (Almost European)"), N_("Times Roman"), N_("Palatino"), N_("Bitstream Charter"),
N_("New Century Schoolbook"), N_("Bookman"), N_("Utopia"), N_("Bera Serif"),
N_("Concrete Roman"), N_("Zapf Chancery"), ""
};
char const * const tex_fonts_sans[] = {"default", "cmss", "lmss", "helvet", "avant", "berasans", "cmbr", ""
};
char const * tex_fonts_sans_gui[] = { N_("Default"), N_("Computer Modern Sans"), N_("Latin Modern Sans"),
N_("Helvetica"), N_("Avant Garde"), N_("Bera Sans"), N_("CM Bright"), ""
};
char const * const tex_fonts_monospaced[] = {"default", "cmtt", "lmtt", "courier", "beramono",
"luximono", "cmtl", ""
};
char const * tex_fonts_monospaced_gui[] = { N_("Default"), N_("Computer Modern Typewriter"),
N_("Latin Modern Typewriter"), N_("Courier"), N_("Bera Mono"), N_("LuxiMono"),
N_("CM Typewriter Light"), ""
};

View File

@ -36,6 +36,16 @@ extern char const * const string_align[];
extern char const * const tex_graphics[];
///
extern char const * const tex_fonts[];
extern char const * const tex_fonts_roman[];
///
extern char const * tex_fonts_roman_gui[];
///
extern char const * const tex_fonts_sans[];
///
extern char const * tex_fonts_sans_gui[];
///
extern char const * const tex_fonts_monospaced[];
///
extern char const * tex_fonts_monospaced_gui[];
#endif

View File

@ -481,8 +481,8 @@ int LyXText::leftMargin(pit_type const pit, pos_type const pos) const
BOOST_ASSERT(pos >= 0);
BOOST_ASSERT(pos <= par.size());
//lyxerr << "LyXText::leftMargin: pit: " << pit << " pos: " << pos << endl;
LyXTextClass const & tclass =
bv()->buffer()->params().getLyXTextClass();
BufferParams const & params = bv()->buffer()->params();
LyXTextClass const & tclass = params.getLyXTextClass();
LyXLayout_ptr const & layout = par.layout();
string parindent = layout->parindent;
@ -492,7 +492,7 @@ int LyXText::leftMargin(pit_type const pit, pos_type const pos) const
if (isMainText())
l_margin += changebarMargin();
l_margin += font_metrics::signedWidth(tclass.leftmargin(), tclass.defaultfont());
l_margin += font_metrics::signedWidth(tclass.leftmargin(), params.getFont());
if (par.getDepth() != 0) {
// find the next level paragraph
@ -521,8 +521,8 @@ int LyXText::leftMargin(pit_type const pit, pos_type const pos) const
switch (layout->margintype) {
case MARGIN_DYNAMIC:
if (!layout->leftmargin.empty())
l_margin += font_metrics::signedWidth(layout->leftmargin,
tclass.defaultfont());
l_margin += font_metrics::signedWidth(layout->leftmargin,
params.getFont());
if (!par.getLabelstring().empty()) {
l_margin += font_metrics::signedWidth(layout->labelindent,
labelfont);
@ -545,7 +545,7 @@ int LyXText::leftMargin(pit_type const pit, pos_type const pos) const
break;
case MARGIN_STATIC:
l_margin += font_metrics::signedWidth(layout->leftmargin, tclass.defaultfont()) * 4
l_margin += font_metrics::signedWidth(layout->leftmargin, params.getFont()) * 4
/ (par.getDepth() + 4);
break;
@ -592,7 +592,7 @@ int LyXText::leftMargin(pit_type const pit, pos_type const pos) const
if (rit->fill() < minfill)
minfill = rit->fill();
l_margin += font_metrics::signedWidth(layout->leftmargin,
tclass.defaultfont());
params.getFont());
l_margin += minfill;
#endif
// also wrong, but much shorter.
@ -631,7 +631,7 @@ int LyXText::leftMargin(pit_type const pit, pos_type const pos) const
|| bv()->buffer()->params().paragraph_separation ==
BufferParams::PARSEP_INDENT))
{
l_margin += font_metrics::signedWidth(parindent, tclass.defaultfont());
l_margin += font_metrics::signedWidth(parindent, params.getFont());
}
return l_margin;
@ -644,13 +644,14 @@ int LyXText::rightMargin(Paragraph const & par) const
if (bv()->text() != this)
return 0;
LyXTextClass const & tclass = bv()->buffer()->params().getLyXTextClass();
BufferParams const & params = bv()->buffer()->params();
LyXTextClass const & tclass = params.getLyXTextClass();
int const r_margin =
::rightMargin()
+ font_metrics::signedWidth(tclass.rightmargin(),
tclass.defaultfont())
params.getFont())
+ font_metrics::signedWidth(par.layout()->rightmargin,
tclass.defaultfont())
params.getFont())
* 4 / (par.getDepth() + 4);
return r_margin;

View File

@ -173,10 +173,19 @@ LyXFont LyXText::getFont(Paragraph const & par, pos_type const pos) const
LyXFont f = par.getFontSettings(params, pos);
if (!isMainText())
applyOuterFont(f);
if (layout->labeltype == LABEL_MANUAL && pos < body_pos)
return f.realize(layout->reslabelfont);
else
return f.realize(layout->resfont);
LyXFont lf;
LyXFont rlf;
if (layout->labeltype == LABEL_MANUAL && pos < body_pos) {
lf = layout->labelfont;
rlf = layout->reslabelfont;
} else {
lf = layout->font;
rlf = layout->resfont;
}
// In case the default family has been customized
if (lf.family() == LyXFont::INHERIT_FAMILY)
rlf.setFamily(params.getFont().family());
return f.realize(rlf);
}
// The uncommon case need not be optimized as much
@ -232,8 +241,13 @@ LyXFont LyXText::getLayoutFont(pit_type const pit) const
{
LyXLayout_ptr const & layout = pars_[pit].layout();
if (!pars_[pit].getDepth())
return layout->resfont;
if (!pars_[pit].getDepth()) {
LyXFont lf = layout->resfont;
// In case the default family has been customized
if (layout->font.family() == LyXFont::INHERIT_FAMILY)
lf.setFamily(bv()->buffer()->params().getFont().family());
return lf;
}
LyXFont font = layout->font;
// Realize with the fonts of lesser depth.
@ -248,8 +262,13 @@ LyXFont LyXText::getLabelFont(Paragraph const & par) const
{
LyXLayout_ptr const & layout = par.layout();
if (!par.getDepth())
return layout->reslabelfont;
if (!par.getDepth()) {
LyXFont lf = layout->reslabelfont;
// In case the default family has been customized
if (layout->labelfont.family() == LyXFont::INHERIT_FAMILY)
lf.setFamily(bv()->buffer()->params().getFont().family());
return lf;
}
LyXFont font = layout->labelfont;
// Realize with the fonts of lesser depth.