Align fontenc with document fonts

Following a request by Günter, we consider the document fonts (only rm
for now) when selecting an appropriate font encoding.

See #9741

The new default font encoding setting "auto" does

* consider the font encoding needed by the language(s), which can now
  have fallback alternatives
* Consider which font encoding is provided by the document font

Thus, cm now will result in OT1 fontenc, if the language can deal with
that.

The font_enc pref is ditched: it is no longer needed.

The automatism is still very basic and is subject to extension.

File format and prefs format change.
This commit is contained in:
Juergen Spitzmueller 2018-04-22 19:06:46 +02:00
parent 337ec5830a
commit 26ea1e1496
24 changed files with 395 additions and 202 deletions

View File

@ -7,7 +7,11 @@ changes happened in particular if possible. A good example would be
-----------------------
2018-04-24 Jürgen Spitzmüller <spitz@lyx.org>
2018-04-22 Jürgen Spitzmüller <spitz@lyx.org>
* format incremented to 550: rename \fontencoding global to \fontencoding auto.
Semantic change: this is now automatically set depending on the document fonts.
2018-04-21 Jürgen Spitzmüller <spitz@lyx.org>
* format incremented to 549: change \textcyr to \textcyrillic.
Dummy format change for now (in case it turns out we need to do something).

View File

@ -22,6 +22,10 @@
!!!The following pref variables are obsoleted in 2.4:
* \font_encoding
The font encoding is now automatically set depending on the document
fonts and languages.
* \use_qimage
This is no longer necessary due to the rewrite of the painter.

View File

@ -1442,18 +1442,13 @@ def checkLatexConfig(check_config, bool_docbook):
if rmcopy:
removeFiles( [ 'chkconfig.ltx' ] )
#
# currently, values in chkconfig are only used to set
# \font_encoding
values = {}
for line in open('chkconfig.vars').readlines():
key, val = re.sub('-', '_', line).split('=')
val = val.strip()
values[key] = val.strip("'")
# chk_fontenc may not exist
try:
addToRC(r'\font_encoding "%s"' % values["chk_fontenc"])
except:
pass
# values in chkconfig were only used to set
# \font_encoding, which is obsolete
# values = {}
# for line in open('chkconfig.vars').readlines():
# key, val = re.sub('-', '_', line).split('=')
# val = val.strip()
# values[key] = val.strip("'")
# if configure successed, move textclass.lst.tmp to textclass.lst
# and packages.lst.tmp to packages.lst
if (os.path.isfile('textclass.lst.tmp')
@ -1795,7 +1790,7 @@ if __name__ == '__main__':
lyx_check_config = True
lyx_kpsewhich = True
outfile = 'lyxrc.defaults'
lyxrc_fileformat = 25
lyxrc_fileformat = 26
rc_entries = ''
lyx_keep_temps = False
version_suffix = ''

View File

@ -140,11 +140,12 @@ enumitem
\papercolumns 1
\papersides 2
\paperpagestyle default
\tracking_changes false
\tracking_changes true
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict true
\author -712698321 "Jürgen Spitzmüller"
\end_header
\begin_body
@ -8335,12 +8336,14 @@ Verbatim
\end_layout
\begin_layout Verbatim
This is Verbatim.
\end_layout
\begin_layout Verbatim
\noindent
\align block
The following 2 lines are empty:
\end_layout
@ -8353,6 +8356,7 @@ The following 2 lines are empty:
\end_layout
\begin_layout Verbatim
Almost everything is allowed in Verbatim:"%&$§#~'`
\backslash
}][{|
@ -8376,6 +8380,7 @@ Verbatim
\end_layout
\begin_layout Verbatim*
This is Verbatim*.
\end_layout
@ -12842,8 +12847,19 @@ Default
Default,
\family default
the font that is preset by the current document class is used.
With LyX's default font encoding, this is a look-alike of the standard
\SpecialChar TeX
With LyX's
\change_deleted -712698321 1524413696
default
\change_inserted -712698321 1524413700
automatic
\change_unchanged
font encoding, this is
\change_inserted -712698321 1524413733
, depending on the document language,
\change_unchanged
\change_inserted -712698321 1524413747
either the the standard \SpecialChar TeX
font
\begin_inset Quotes eld
\end_inset
@ -12864,7 +12880,36 @@ Modern
\family typewriter
cm
\family default
): either
) or
\change_unchanged
a look-alike of
\change_deleted -712698321 1524413754
the standard \SpecialChar TeX
font
\begin_inset Quotes eld
\end_inset
\family typewriter
Computer
\begin_inset space ~
\end_inset
Modern
\family default
\begin_inset Quotes erd
\end_inset
(
\family typewriter
cm
\family default
)
\change_inserted -712698321 1524413756
this font
\change_unchanged
: either
\begin_inset Quotes eld
\end_inset
@ -13244,6 +13289,8 @@ status collapsed
\end_inset
\change_deleted -712698321 1524413571
(see also section
\begin_inset space ~
\end_inset
@ -13255,11 +13302,19 @@ reference "subsec:LaTeX-settings"
\end_inset
).
)
\change_unchanged
.
Normally, you do not need to change (or even understand) this.
Unless you have specific reasons, use
\change_deleted -712698321 1524413471
\family sans
Default
\change_inserted -712698321 1524413474
Automatic
\change_unchanged
\family default
.
\end_layout
@ -47833,6 +47888,8 @@ Settings ! \SpecialChar LaTeX
\end_layout
\begin_layout Description
\change_deleted -712698321 1524413534
Use
\begin_inset space ~
\end_inset
@ -47893,6 +47950,8 @@ T1, T2B
\SpecialChar LyX
sets up in the background.
So there is no need to change the default encoding.
\change_unchanged
\end_layout
\begin_layout Description

View File

@ -10,10 +10,10 @@
# BabelName <babelname>
# PolyglossiaName <polyglossianame>
# PolyglossiaOpts "<language-specific options>"
# Encoding <encoding>
# FontEncoding <font encoding>
# QuoteStyle <british|danish|english|french|frenchin|
# german|polish|russian|swedish|swedishg|swiss|plain>
# Encoding <encoding>
# FontEncoding <font encoding|font encoding|...]>
# InternalEncoding <true|false>
# RTL <true|false>
# AsBabelOptions <true|false>
@ -68,13 +68,23 @@
# is set to "Language Default" and "use non-TeX fonts" is FALSE.
# Encoding "inherit" means: keep encoding of the context (used by
# latex_language).
# * InternalEncoding is used to tell LyX that babel internally sets a
# non-standard font encoding (such as hebrew to LHE or greek to LGR).
# If True, LyX cares for characters/macros that do not exist in
# some font encodings ("<", ">", "|" and straight quote).
# It is not required for standard encodings like T2A. See bug #5091.
# * FontEncoding is a bar-separated list of font encodings.
# The first value is the required font encoding for correct hyphenation with
# 8-bit TeX (http://www.hyphenation.org). Eventually following values may be
# used if the selected font is unavailable in FontEncoding. They provide all
# letters used in the language, but some only as "surrogate pairs" with
# possible problems for hyphenation and drag-and-drop from the generated
# documents.
# If not given, all standard text encodings (T<n>) as well as OT1 work.
# * "FontEncoding none" tells LyX that fontenc should not be loaded with this
# language.
# * "FontEncoding ASCII" means: "works with any standard text encoding
# as well as OT1".
# * InternalEncoding is used to tell LyX that babel internally sets a
# non-standard font encoding (such as hebrew to LHE or greek to LGR).
# If True, LyX takes care for characters/macros that do not exist in
# some font encodings ("<", ">", "|" and straight quote).
# It is not required for standard encodings like T2A. See bug #5091.
# * AsBabelOptions advices LyX to pass the languages locally to babel, not
# globally to the class. Some languages (basically those not directly
# supported by babel) need this.
@ -126,15 +136,18 @@ Language afrikaans
BabelName afrikaans
QuoteStyle polish
Encoding iso8859-15
FontEncoding T1|OT1
LangCode af_ZA
End
# FontEncoding: no hyphenation, but uses Ç/ç und Ë/ë
Language albanian
GuiName "Albanian"
BabelName albanian
PolyglossiaName albanian
QuoteStyle swiss
Encoding iso8859-2
FontEncoding T1|OT1
LangCode sq_AL
End
@ -145,6 +158,7 @@ Language american
PolyglossiaOpts "variant=american"
QuoteStyle english
Encoding iso8859-15
FontEncoding ASCII
LangCode en_US
End
@ -217,12 +231,14 @@ Language asturian
LangCode ast_ES
End
Language australian
GuiName "English (Australia)"
BabelName australian
PolyglossiaName english
PolyglossiaOpts "variant=australian"
Encoding iso8859-15
FontEncoding ASCII
QuoteStyle english
LangCode en_AU
End
@ -236,6 +252,7 @@ Language austrian
PolyglossiaOpts "variant=austrian,spelling=old,babelshorthands=true"
QuoteStyle german
Encoding iso8859-15
FontEncoding T1|OT1
LangCode de_AT
End
@ -248,6 +265,7 @@ Language naustrian
PolyglossiaOpts "variant=austrian,spelling=new,babelshorthands=true"
QuoteStyle german
Encoding iso8859-15
FontEncoding T1|OT1
LangCode de_AT
End
@ -258,6 +276,7 @@ Language bahasa
PolyglossiaName bahasai
QuoteStyle english
Encoding iso8859-15
FontEncoding ASCII
LangCode id_ID
End
@ -277,6 +296,7 @@ Language basque
PolyglossiaName basque
QuoteStyle swiss
Encoding iso8859-15
FontEncoding T1|OT1
LangCode eu_ES
PostBabelPreamble
\addto\extrasbasque{\bbl@deactivate{~}}
@ -289,6 +309,7 @@ Language belarusian
BabelName belarusian
QuoteStyle french
Encoding cp1251
FontEncoding T2A
LangCode be_BY
AsBabelOptions true
End
@ -299,6 +320,7 @@ Language bosnian
BabelName bosnian
QuoteStyle polish
Encoding iso8859-2
FontEncoding T1|OT1
LangCode bs_BA
End
@ -309,15 +331,18 @@ Language brazilian
PolyglossiaName brazil
QuoteStyle english
Encoding iso8859-15
FontEncoding T1|OT1
LangCode pt_BR
End
# FontEncoding: # ? no hyphenation, but uses ñ
Language breton
GuiName "Breton"
BabelName breton
PolyglossiaName breton
QuoteStyle french
Encoding iso8859-15
#FontEncoding T1
LangCode br_FR
End
@ -328,6 +353,7 @@ Language british
PolyglossiaOpts "variant=british"
QuoteStyle british
Encoding iso8859-15
FontEncoding ASCII
LangCode en_GB
End
@ -350,6 +376,7 @@ Language canadian
# PolyglossiaOpts "variant=canadian"
QuoteStyle english
Encoding iso8859-15
FontEncoding ASCII
LangCode en_CA
End
@ -363,6 +390,7 @@ Language canadien
# PolyglossiaOpts "variant=canadien"
QuoteStyle french
Encoding iso8859-15
FontEncoding T1|OT1
LangCode fr_CA
End
@ -374,6 +402,7 @@ Language catalan
PolyglossiaOpts "babelshorthands=true"
QuoteStyle french
Encoding iso8859-15
FontEncoding T1|OT1
LangCode ca_ES
End
@ -411,6 +440,7 @@ Language croatian
PolyglossiaName croatian
QuoteStyle polish
Encoding iso8859-2
FontEncoding T1|OT1
LangCode hr_HR
End
@ -421,6 +451,7 @@ Language czech
PolyglossiaName czech
QuoteStyle german
Encoding iso8859-2
FontEncoding T1|OT1
LangCode cs_CZ
End
@ -431,6 +462,7 @@ Language danish
PolyglossiaName danish
QuoteStyle danish
Encoding iso8859-15
FontEncoding T1|OT1
LangCode da_DK
End
@ -450,6 +482,7 @@ Language dutch
PolyglossiaOpts "babelshorthands=true"
QuoteStyle polish
Encoding iso8859-15
FontEncoding T1|OT1
LangCode nl_NL
End
@ -461,6 +494,7 @@ Language english
PolyglossiaOpts "variant=american"
QuoteStyle english
Encoding iso8859-15
FontEncoding ASCII
LangCode en_US
End
@ -472,6 +506,7 @@ Language esperanto
PolyglossiaName esperanto
QuoteStyle english
Encoding iso8859-3
FontEncoding IL3|T1|OT1
LangCode eo_EO
End
@ -481,6 +516,7 @@ Language estonian
PolyglossiaName estonian
QuoteStyle german
Encoding iso8859-15
FontEncoding T1|OT1
LangCode et_EE
PostBabelPreamble
\addto\extrasestonian{\bbl@deactivate{~}}
@ -511,6 +547,7 @@ Language finnish
PolyglossiaName finnish
QuoteStyle swedish
Encoding iso8859-15
FontEncoding T1|OT1
LangCode fi_FI
End
@ -522,6 +559,7 @@ Language french
PolyglossiaName french
QuoteStyle french
Encoding iso8859-15
FontEncoding T1|OT1
LangCode fr_FR
PostBabelPreamble
\addto\extrasfrench{%
@ -538,6 +576,7 @@ Language friulan
PolyglossiaName friulan
QuoteStyle french
Encoding iso8859-15
FontEncoding T1|OT1
LangCode fur_IT
End
@ -548,6 +587,7 @@ Language galician
PolyglossiaName galician
QuoteStyle french
Encoding iso8859-15
FontEncoding T1|OT1
LangCode gl_ES
PostBabelPreamble
\addto\shorthandsgalician{\galiciandeactivate{~}}
@ -571,6 +611,7 @@ Language german
PolyglossiaOpts "variant=german,spelling=old,babelshorthands=true"
QuoteStyle german
Encoding iso8859-15
FontEncoding T1|OT1
LangCode de
LangVariety alt
End
@ -583,6 +624,7 @@ Language ngerman
PolyglossiaOpts "variant=german,spelling=new,babelshorthands=true"
QuoteStyle german
Encoding iso8859-15
FontEncoding T1|OT1
LangCode de_DE
End
@ -597,6 +639,7 @@ Language german-ch
PolyglossiaOpts "variant=swiss,spelling=new,babelshorthands=true"
QuoteStyle swiss
Encoding iso8859-15
FontEncoding T1|OT1
LangCode de_CH
End
@ -610,6 +653,7 @@ Language german-ch-old
PolyglossiaOpts "variant=swiss,spelling=old,babelshorthands=true"
QuoteStyle swiss
Encoding iso8859-15
FontEncoding T1|OT1
LangCode de_CH
End
@ -675,12 +719,14 @@ End
# QuoteStyle polish
#End
# FontEncoding: OT1 misses ð and Þ
Language icelandic
GuiName "Icelandic"
BabelName icelandic
PolyglossiaName icelandic
QuoteStyle german
Encoding iso8859-15
FontEncoding T1
LangCode is_IS
End
@ -692,6 +738,7 @@ Language interlingua
BabelName interlingua
PolyglossiaName interlingua
Encoding iso8859-15
FontEncoding ASCII
LangCode ia_IA
QuoteStyle english
End
@ -702,6 +749,7 @@ Language irish
PolyglossiaName irish
QuoteStyle english
Encoding iso8859-15
FontEncoding T1|OT1
LangCode ga_IE
End
@ -712,6 +760,7 @@ Language italian
PolyglossiaName italian
QuoteStyle french
Encoding iso8859-15
FontEncoding ASCII
LangCode it_IT
End
@ -755,6 +804,7 @@ End
Language kazakh
GuiName "Kazakh"
Encoding ascii
FontEncoding T2A
LangCode kk_KZ
PostBabelPreamble
\input{t2aenc.def}
@ -783,6 +833,7 @@ Language kurmanji
GuiName "Kurmanji"
BabelName kurmanji
Encoding utf8
FontEncoding T1|OT1
LangCode kmr
AsBabelOptions true
End
@ -802,24 +853,27 @@ Language latin
BabelName latin
PolyglossiaName latin
Encoding iso8859-15
FontEncoding T1|OT1
LangCode la_LA
End
# latvian must be loaded locally with babel options,
# not globally via class options
# FontEncoding: L7x required for hyphenation but not set by Babel
Language latvian
GuiName "Latvian"
BabelName latvian
PolyglossiaName latvian
QuoteStyle german
Encoding iso8859-4
# FontEncoding L7x # (required for hyphenation but not set by babel)
FontEncoding L7x|T1|OT1
LangCode lv_LV
AsBabelOptions true
End
# lithuanian must be loaded locally with babel options,
# not globally via class options
# FontEncoding: L7x set by Babel
Language lithuanian
GuiName "Lithuanian"
BabelName lithuanian
@ -837,6 +891,7 @@ Language lowersorbian
PolyglossiaName lsorbian
QuoteStyle german
Encoding iso8859-2
FontEncoding T1|OT1
LangCode dsb_DE
End
@ -847,6 +902,7 @@ Language magyar
PolyglossiaName magyar
QuoteStyle polish
Encoding iso8859-2
FontEncoding T1|OT1
LangCode hu_HU
End
@ -889,6 +945,7 @@ Language newzealand
PolyglossiaOpts "variant=newzealand"
QuoteStyle english
Encoding iso8859-15
FontEncoding ASCII
LangCode en_NZ
End
@ -899,6 +956,7 @@ Language norsk
PolyglossiaName norsk
QuoteStyle swiss
Encoding iso8859-15
FontEncoding T1|OT1
LangCode nb_NO
End
@ -909,6 +967,7 @@ Language nynorsk
PolyglossiaName nynorsk
QuoteStyle swiss
Encoding iso8859-15
FontEncoding T1|OT1
LangCode nn_NO
End
@ -941,9 +1000,11 @@ Language piedmontese
PolyglossiaName piedmontese
QuoteStyle french
Encoding iso8859-15
FontEncoding ASCII
LangCode pms_IT
End
# FontEncoding: QX required for hyphenation but not set by babel
Language polish
GuiName "Polish"
HasGuiSupport true
@ -951,7 +1012,7 @@ Language polish
PolyglossiaName polish
QuoteStyle polish
Encoding iso8859-2
# FontEncoding QX # (required for hyphenation but not set by babel)
FontEncoding QX|T1|OT1
LangCode pl_PL
End
@ -962,6 +1023,7 @@ Language portuguese
PolyglossiaName portuges
QuoteStyle french
Encoding iso8859-15
FontEncoding T1|OT1
LangCode pt_PT
End
@ -972,6 +1034,7 @@ Language romanian
PolyglossiaName romanian
QuoteStyle polish
Encoding iso8859-16
FontEncoding T1|OT1
LangCode ro_RO
End
@ -982,6 +1045,7 @@ Language romansh
PolyglossiaName romansh
QuoteStyle german
Encoding iso8859-15
FontEncoding ASCII
LangCode rm_CH
End
@ -997,11 +1061,13 @@ Language russian
Provides textcyrillic
End
# FontEncoding: no hyphenation, but diacritics
Language samin
GuiName "North Sami"
BabelName samin
PolyglossiaName samin
Encoding iso8859-15
FontEncoding T1|OT1
LangCode se_NO
End
@ -1013,12 +1079,15 @@ Language sanskrit
LangCode sa_IN
End
# Gaidhlig (Scottish Gaelic)
# FontEncoding: no hyphenation, grave accent (à, è, ì, ò, ù)
Language scottish
GuiName "Scottish"
BabelName scottish
PolyglossiaName scottish
QuoteStyle english
Encoding iso8859-15
FontEncoding T1|OT1
LangCode gd_GB
End
@ -1046,6 +1115,7 @@ Language serbian-latin
PolyglossiaOpts "script=Latin"
QuoteStyle polish
Encoding iso8859-2
FontEncoding T1|OT1
LangCode sr_RS-Latin
End
@ -1056,6 +1126,7 @@ Language slovak
PolyglossiaName slovak
QuoteStyle german
Encoding iso8859-2
FontEncoding T1|OT1
LangCode sk_SK
End
@ -1065,6 +1136,7 @@ Language slovene
PolyglossiaName slovenian
QuoteStyle german
Encoding iso8859-2
FontEncoding T1|OT1
LangCode sl_SI
End
@ -1075,6 +1147,7 @@ Language spanish
PolyglossiaName spanish
QuoteStyle french
Encoding iso8859-15
FontEncoding T1|OT1
LangCode es_ES
PostBabelPreamble
\addto\shorthandsspanish{\spanishdeactivate{~<>}}
@ -1088,6 +1161,7 @@ Language spanish-mexico
PolyglossiaName spanish
QuoteStyle french
Encoding iso8859-15
FontEncoding T1|OT1
LangCode es_MX
PostBabelPreamble
\addto\shorthandsspanish{\spanishdeactivate{~<>.}}
@ -1101,6 +1175,7 @@ Language swedish
PolyglossiaName swedish
QuoteStyle swedish
Encoding iso8859-15
FontEncoding T1|OT1
LangCode sv_SE
End
@ -1135,7 +1210,7 @@ Language thai
PolyglossiaName thai
QuoteStyle english
Encoding tis620-0
# FontEncoding LTH
FontEncoding LTH
LangCode th_TH
PostBabelPreamble
\usepackage{thswitch}
@ -1157,6 +1232,7 @@ Language turkish
PolyglossiaName turkish
QuoteStyle english
Encoding iso8859-9
FontEncoding T1|OT1
LangCode tr_TR
PostBabelPreamble
\usepackage{xkeyval}
@ -1171,6 +1247,7 @@ Language turkmen
PolyglossiaName turkmen
QuoteStyle swiss
Encoding utf8
FontEncoding T1|OT1
LangCode tk_TM
AsBabelOptions true
End
@ -1193,6 +1270,7 @@ Language uppersorbian
PolyglossiaName usorbian
QuoteStyle german
Encoding iso8859-2
FontEncoding T1|OT1
LangCode hsb_DE
End
@ -1211,6 +1289,7 @@ Language vietnamese
PolyglossiaName vietnamese
QuoteStyle english
Encoding utf8
FontEncoding T5
LangCode vi_VN
End
@ -1220,5 +1299,6 @@ Language welsh
PolyglossiaName welsh
QuoteStyle british
Encoding iso8859-15
FontEncoding T1|OT1
LangCode cy_GB
End

View File

@ -7,6 +7,7 @@
# Font <name>
# GuiName "<Gui Name>"
# Family <rm|sf|tt|math>
# FontEncoding <font encoding>
# SwitchDefault <0|1>
# Package <LaTeX package to be loaded>
# Requires <LaTeX package to test for>
@ -33,6 +34,7 @@
# * Adding a new font results in a FILE FORMAT CHANGE. So if a new font
# is added for the LyX distribution, the according changes need to be
# done.
# * If FontEncoding is not specified, T1 is assumed.
# * "SwitchDefault 1" makes the font to be loaded by switching the default
# family to <name> (e.g., \renewcommand{\rmdefault}{cmr}), whereas
# Package <package> loads it via \usepackage{package}. Only one of these
@ -141,6 +143,7 @@ EndFont
Font cmr
GuiName "Computer Modern Roman"
Family rm
FontEncoding OT1
SwitchDefault 1
OsfFont eco
EndFont
@ -521,6 +524,7 @@ EndFont
Font cmss
GuiName "Computer Modern Sans"
Family sf
FontEncoding OT1
SwitchDefault 1
EndFont
@ -652,6 +656,7 @@ EndFont
Font cmtt
GuiName "Computer Modern Typewriter"
Family tt
FontEncoding OT1
SwitchDefault 1
EndFont

View File

@ -182,6 +182,26 @@ def revert_lscape(document):
# no need to reset i
def convert_fontenc(document):
" Convert default fontenc setting "
i = find_token(document.header, "\\fontencoding global", 0)
if i == -1:
return
document.header[i] = document.header[i].replace("global", "auto")
def revert_fontenc(document):
" Revert default fontenc setting "
i = find_token(document.header, "\\fontencoding auto", 0)
if i == -1:
return
document.header[i] = document.header[i].replace("auto", "global")
##
# Conversion hub
#
@ -192,10 +212,12 @@ convert = [
[546, []],
[547, []],
[548, []],
[549, []]
[549, []],
[550, [convert_fontenc]]
]
revert = [
[549, [revert_fontenc]],
[548, []],# dummy format change
[547, [revert_lscape]],
[546, [revert_xcharter]],

View File

@ -105,6 +105,9 @@
# Incremented to format 25, by lasgouttes
# Remove use_qimage preference
# Incremented to format 26, by spitz
# Rename font_encoding preference
# NOTE: The format should also be updated in LYXRC.cpp and
# in configure.py.
@ -394,6 +397,11 @@ def remove_use_qimage(line):
return no_match
return (True, "")
def remove_font_encoding(line):
if not line.lower().startswith("\\font_encoding "):
return no_match
return (True, "")
# End conversions for LyX 2.3 to 2.4
####################################
@ -433,5 +441,6 @@ conversions = [
[ 22, []],
[ 23, []],
[ 24, [rename_collapsible]],
[ 25, [remove_use_qimage]]
[ 25, [remove_use_qimage]],
[ 26, [remove_font_encoding]]
]

View File

@ -406,7 +406,7 @@ BufferParams::BufferParams()
secnumdepth = 3;
tocdepth = 3;
language = default_language;
fontenc = "global";
fontenc = "auto";
fonts_roman[0] = "default";
fonts_roman[1] = "default";
fonts_sans[0] = "default";
@ -3120,20 +3120,21 @@ string const BufferParams::main_font_encoding() const
vector<string> const BufferParams::font_encodings() const
{
string doc_fontenc = (fontenc == "global") ? lyxrc.fontenc : fontenc;
string doc_fontenc = (fontenc == "auto") ? string() : fontenc;
vector<string> fontencs;
// "default" means "no explicit font encoding"
if (doc_fontenc != "default") {
fontencs = getVectorFromString(doc_fontenc);
if (!language->fontenc().empty()
&& ascii_lowercase(language->fontenc()) != "none") {
vector<string> fencs = getVectorFromString(language->fontenc());
vector<string>::const_iterator fit = fencs.begin();
for (; fit != fencs.end(); ++fit) {
if (find(fontencs.begin(), fontencs.end(), *fit) == fontencs.end())
fontencs.push_back(*fit);
if (!doc_fontenc.empty())
// If we have a custom setting, we use only that!
return getVectorFromString(doc_fontenc);
if (!language->fontenc(*this).empty()
&& ascii_lowercase(language->fontenc(*this)) != "none") {
vector<string> fencs = getVectorFromString(language->fontenc(*this));
for (auto & fe : fencs) {
if (find(fontencs.begin(), fontencs.end(), fe) == fontencs.end())
fontencs.push_back(fe);
}
}
}

View File

@ -905,11 +905,10 @@ void LaTeXFeatures::getFontEncodings(vector<string> & encs, bool const onlylangs
}
for (auto const & lang : UsedLanguages_)
if (!lang->fontenc().empty()
&& ascii_lowercase(lang->fontenc()) != "none") {
vector<string> extraencs = getVectorFromString(lang->fontenc());
if (!lang->fontencs().empty()) {
vector<string> extraencs = lang->fontencs();
for (auto const & extra : extraencs) {
if (find(encs.begin(), encs.end(), extra) == encs.end())
if (extra != "none" && find(encs.begin(), encs.end(), extra) == encs.end())
encs.insert(encs.begin(), extra);
}
}

View File

@ -310,6 +310,16 @@ string const LaTeXFont::getLaTeXCode(bool dryrun, bool ot1, bool complete, bool
}
bool LaTeXFont::hasFontenc(string const & name) const
{
for (auto const & fe : fontenc_) {
if (fe == name)
return true;
}
return false;
}
bool LaTeXFont::readFont(Lexer & lex)
{
enum LaTeXFontTags {
@ -317,6 +327,7 @@ bool LaTeXFont::readFont(Lexer & lex)
LF_COMPLETE_FONT,
LF_END,
LF_FAMILY,
LF_FONTENC,
LF_GUINAME,
LF_NOMATHFONT,
LF_OSFDEFAULT,
@ -340,6 +351,7 @@ bool LaTeXFont::readFont(Lexer & lex)
{ "completefont", LF_COMPLETE_FONT },
{ "endfont", LF_END },
{ "family", LF_FAMILY },
{ "fontencoding", LF_FONTENC },
{ "guiname", LF_GUINAME },
{ "nomathfont", LF_NOMATHFONT },
{ "osfdefault", LF_OSFDEFAULT },
@ -395,6 +407,12 @@ bool LaTeXFont::readFont(Lexer & lex)
case LF_GUINAME:
lex >> guiname_;
break;
case LF_FONTENC: {
lex.eatLine();
string fe = lex.getString();
fontenc_ = getVectorFromString(fe);
break;
}
case LF_NOMATHFONT:
lex >> nomathfont_;
break;
@ -468,6 +486,9 @@ bool LaTeXFont::read(Lexer & lex)
return false;
}
if (fontenc_.empty())
fontenc_.push_back("T1");
return true;
}

View File

@ -35,6 +35,10 @@ public:
docstring const & family() { return family_; }
/// The package that provides this font
docstring const & package() { return package_; }
/// Does this provide a specific font encoding?
bool hasFontenc(std::string const &) const;
/// The font encoding(s)
std::vector<std::string> const & fontencs() const { return fontenc_; }
/// Alternative font if package() is not available
std::vector<docstring> const & altfonts() { return altfonts_; }
/// A font that provides all families
@ -109,6 +113,8 @@ private:
///
docstring package_;
///
std::vector<std::string> fontenc_;
///
std::vector<docstring> altfonts_;
///
docstring completefont_;

View File

@ -16,6 +16,7 @@
#include "Language.h"
#include "Encoding.h"
#include "LaTeXFonts.h"
#include "Lexer.h"
#include "LyXRC.h"
@ -71,6 +72,37 @@ docstring const Language::translateLayout(string const & m) const
}
vector<string> Language::fontencs() const
{
return fontenc_;
}
string Language::fontenc(BufferParams const & params) const
{
// Determine optimal font encoding
// We check whether the used rm font supports an encoding our language supports
for (auto & fe : fontenc_) {
LaTeXFont const & lf = theLaTeXFonts().getLaTeXFont(from_ascii(params.fontsRoman()));
// ASCII means: support all T* encodings plus OT1
if (fe == "ASCII") {
vector<string> const lfe = lf.fontencs();
for (auto & afe : lfe) {
if (afe == "OT1" || prefixIs(afe, "T"))
// we found a suitable one; return that.
return afe;
}
}
// For other encodings, just check whether the font supports it
if (lf.hasFontenc(fe))
return fe;
}
// We did not find a suitable one; just take the first in the list,
// the priorized one (which is "T1" for ASCII).
return fontencs().front() == "ASCII" ? "T1" : fontencs().front();
}
bool Language::readLanguage(Lexer & lex)
{
enum LanguageTags {
@ -157,9 +189,13 @@ bool Language::readLanguage(Lexer & lex)
case LA_ENCODING:
lex >> encodingStr_;
break;
case LA_FONTENC:
lex >> fontenc_;
case LA_FONTENC: {
lex.eatLine();
vector<string> const fe =
getVectorFromString(lex.getString(true), "|");
fontenc_.insert(fontenc_.end(), fe.begin(), fe.end());
break;
}
case LA_GUINAME:
lex >> display_;
break;
@ -223,6 +259,8 @@ bool Language::read(Lexer & lex)
encoding_ = encodings.fromLyXName("iso8859-1");
LYXERR0("Unknown encoding " << encodingStr_);
}
if (fontenc_.empty())
fontenc_.push_back("ASCII");
return true;
}

View File

@ -15,10 +15,13 @@
#ifndef LANGUAGE_H
#define LANGUAGE_H
#include "BufferParams.h"
#include "support/docstring.h"
#include "support/trivstring.h"
#include <map>
#include <vector>
namespace lyx {
@ -82,7 +85,9 @@ public:
/// This language internally sets a font encoding
bool internalFontEncoding() const { return internal_enc_; }
/// fontenc encoding(s)
std::string const fontenc() const { return fontenc_; }
std::string fontenc(BufferParams const &) const;
/// fontenc encoding(s)
std::vector<std::string> fontencs() const;
/// This language needs to be passed to babel itself (not the class)
bool asBabelOptions() const { return as_babel_options_; }
/// This language corresponds to a translation of the GUI
@ -129,7 +134,7 @@ private:
///
trivdocstring babel_presettings_;
///
trivstring fontenc_;
std::vector<std::string> fontenc_;
///
bool internal_enc_;
///

View File

@ -59,7 +59,7 @@ namespace {
// The format should also be updated in configure.py, and conversion code
// should be added to prefs2prefs_prefs.py.
static unsigned int const LYXRC_FILEFORMAT = 25; // lasgouttes: remove qimage
static unsigned int const LYXRC_FILEFORMAT = 26; // spitz: remove font_encoding
// when adding something to this array keep it sorted!
LexerKeyword lyxrcTags[] = {
@ -107,7 +107,6 @@ LexerKeyword lyxrcTags[] = {
{ "\\escape_chars", LyXRC::RC_ESC_CHARS },
{ "\\example_path", LyXRC::RC_EXAMPLEPATH },
{ "\\export_overwrite", LyXRC::RC_EXPORT_OVERWRITE },
{ "\\font_encoding", LyXRC::RC_FONT_ENCODING },
{ "\\format", LyXRC::RC_FILEFORMAT },
{ "\\forward_search_dvi", LyXRC::RC_FORWARD_SEARCH_DVI },
{ "\\forward_search_pdf", LyXRC::RC_FORWARD_SEARCH_PDF },
@ -241,7 +240,6 @@ void LyXRC::setDefaults()
default_platex_view_format = "pdf3";
chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
bibtex_command = "automatic";
fontenc = "default";
index_command = "makeindex -c -q";
nomencl_command = "makeindex -s nomencl.ist";
pygmentize_command = string();
@ -534,10 +532,6 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
}
break;
case RC_FONT_ENCODING:
lexrc >> fontenc;
break;
case RC_PRINTLANDSCAPEFLAG:
lexrc >> print_landscape_flag;
break;
@ -2119,18 +2113,9 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
if (tag != RC_LAST)
break;
// fall through
case RC_FONT_ENCODING:
if (ignore_system_lyxrc ||
fontenc != system_lyxrc.fontenc) {
os << "\\font_encoding \"" << fontenc << "\"\n";
}
if (tag != RC_LAST)
break;
os << "\n#\n"
<< "# FILE SECTION ######################################\n"
<< "#\n\n";
// fall through
case RC_DOCUMENTPATH:
if (ignore_system_lyxrc ||
@ -2945,7 +2930,6 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
case LyXRC::RC_EDITOR_ALTERNATIVES:
case LyXRC::RC_ESC_CHARS:
case LyXRC::RC_EXAMPLEPATH:
case LyXRC::RC_FONT_ENCODING:
case LyXRC::RC_FILEFORMAT:
case LyXRC::RC_GROUP_LAYOUTS:
case LyXRC::RC_HUNSPELLDIR_PATH:
@ -3196,10 +3180,6 @@ string const LyXRC::getDescription(LyXRCTags tag)
str = _("The path that LyX will set when offering to choose an example. An empty value selects the directory LyX was started from.");
break;
case RC_FONT_ENCODING:
str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
break;
case RC_FILEFORMAT:
break;

View File

@ -80,7 +80,6 @@ public:
RC_ESC_CHARS,
RC_EXAMPLEPATH,
RC_EXPORT_OVERWRITE,
RC_FONT_ENCODING,
RC_FILEFORMAT,
RC_FORWARD_SEARCH_DVI,
RC_FORWARD_SEARCH_PDF,
@ -308,8 +307,6 @@ public:
/// DPI of monitor
unsigned int dpi;
///
std::string fontenc;
///
std::string roman_font_name;
///
std::string sans_font_name;

View File

@ -314,13 +314,15 @@ public:
/// Output the surrogate pair formed by \p c and \p next to \p os.
/// \return the number of characters written.
int latexSurrogatePair(otexstream & os, char_type c, char_type next,
int latexSurrogatePair(BufferParams const &, otexstream & os,
char_type c, char_type next,
OutputParams const &);
/// Output a space in appropriate formatting (or a surrogate pair
/// if the next character is a combining character).
/// \return whether a surrogate pair was output.
bool simpleTeXBlanks(OutputParams const &,
bool simpleTeXBlanks(BufferParams const &,
OutputParams const &,
otexstream &,
pos_type i,
unsigned int & column,
@ -330,7 +332,8 @@ public:
/// Output consecutive unicode chars, belonging to the same script as
/// specified by the latex macro \p ltx, to \p os starting from \p i.
/// \return the number of characters written.
int writeScriptChars(OutputParams const &, otexstream & os,
int writeScriptChars(BufferParams const &, OutputParams const &,
otexstream & os,
docstring const & ltx,
Change const &, Encoding const &,
std::string const, pos_type & i);
@ -867,8 +870,9 @@ int Paragraph::eraseChars(pos_type start, pos_type end, bool trackChanges)
}
int Paragraph::Private::latexSurrogatePair(otexstream & os, char_type c,
char_type next, OutputParams const & runparams)
int Paragraph::Private::latexSurrogatePair(BufferParams const & bparams,
otexstream & os, char_type c, char_type next,
OutputParams const & runparams)
{
// Writing next here may circumvent a possible font change between
// c and next. Since next is only output if it forms a surrogate pair
@ -907,7 +911,7 @@ int Paragraph::Private::latexSurrogatePair(otexstream & os, char_type c,
int length = brace2;
string fontenc;
if (runparams.local_font)
fontenc = runparams.local_font->language()->fontenc();
fontenc = runparams.local_font->language()->fontenc(bparams);
else
fontenc = runparams.main_fontenc;
docstring scriptmacro;
@ -940,7 +944,8 @@ int Paragraph::Private::latexSurrogatePair(otexstream & os, char_type c,
}
bool Paragraph::Private::simpleTeXBlanks(OutputParams const & runparams,
bool Paragraph::Private::simpleTeXBlanks(BufferParams const & bparams,
OutputParams const & runparams,
otexstream & os,
pos_type i,
unsigned int & column,
@ -954,7 +959,7 @@ bool Paragraph::Private::simpleTeXBlanks(OutputParams const & runparams,
char_type next = text_[i + 1];
if (Encodings::isCombiningChar(next)) {
// This space has an accent, so we must always output it.
column += latexSurrogatePair(os, ' ', next, runparams) - 1;
column += latexSurrogatePair(bparams, os, ' ', next, runparams) - 1;
return true;
}
}
@ -985,7 +990,8 @@ bool Paragraph::Private::simpleTeXBlanks(OutputParams const & runparams,
}
int Paragraph::Private::writeScriptChars(OutputParams const & runparams,
int Paragraph::Private::writeScriptChars(BufferParams const & bparams,
OutputParams const & runparams,
otexstream & os,
docstring const & ltx,
Change const & runningChange,
@ -1047,7 +1053,7 @@ int Paragraph::Private::writeScriptChars(OutputParams const & runparams,
if (i + 2 < size) {
next_next = text_[i + 2];
if (Encodings::isCombiningChar(next_next)) {
length += latexSurrogatePair(os, next, next_next, runparams) - 1;
length += latexSurrogatePair(bparams, os, next, next_next, runparams) - 1;
i += 2;
continue;
}
@ -1362,7 +1368,7 @@ void Paragraph::Private::latexSpecialChar(otexstream & os,
if (i + 1 < int(text_.size())) {
next = text_[i + 1];
if (Encodings::isCombiningChar(next)) {
column += latexSurrogatePair(os, c, next, runparams) - 1;
column += latexSurrogatePair(bparams, os, c, next, runparams) - 1;
++i;
break;
}
@ -1392,7 +1398,7 @@ void Paragraph::Private::latexSpecialChar(otexstream & os,
if (running_font.language()->lang() == bparams.language->lang())
fontenc = runparams.main_fontenc;
else
fontenc = running_font.language()->fontenc();
fontenc = running_font.language()->fontenc(bparams);
// "Script chars" need to embraced in \textcyrillic and \textgreek notwithstanding
// whether they are encodable or not (it only depends on the font encoding)
if (!runparams.isFullUnicode() && Encodings::isKnownScriptChar(c, script)) {
@ -1400,7 +1406,7 @@ void Paragraph::Private::latexSpecialChar(otexstream & os,
docstring ltx = latex.first;
if (!prefixIs(ltx, wrapper))
ltx = wrapper + latex.first + from_ascii("}");
column += writeScriptChars(runparams, os, ltx, running_change,
column += writeScriptChars(bparams, runparams, os, ltx, running_change,
encoding, fontenc, i) - 1;
} else if (latex.second
&& ((!prefixIs(nextlatex, '\\')
@ -1557,7 +1563,7 @@ void Paragraph::Private::validate(LaTeXFeatures & features) const
|| ((&owner_->getFontSettings(bp, i))->language()->internalFontEncoding()))
features.require("textquotedbl");
} else if (Encodings::isKnownScriptChar(c, bscript)){
string fontenc = (&owner_->getFontSettings(bp, i))->language()->fontenc();
string fontenc = (&owner_->getFontSettings(bp, i))->language()->fontenc(bp);
if (fontenc.empty())
fontenc = features.runparams().main_fontenc;
if (Encodings::needsScriptWrapper("textbaltic", fontenc))
@ -2689,7 +2695,7 @@ void Paragraph::latex(BufferParams const & bparams,
// latexSpecialChar ignores spaces if
// style.pass_thru is false.
if (i != body_pos - 1) {
if (d->simpleTeXBlanks(runparams, os,
if (d->simpleTeXBlanks(bparams, runparams, os,
i, column, current_font, style)) {
// A surrogate pair was output. We
// must not call latexSpecialChar

View File

@ -841,6 +841,62 @@ GuiDocument::GuiDocument(GuiView & lv)
connect(outputModule->saveTransientPropertiesCB, SIGNAL(clicked()),
this, SLOT(change_adaptor()));
// language & quote
// this must preceed font, since fonts depend on this
langModule = new UiWidget<Ui::LanguageUi>(this);
connect(langModule->languageCO, SIGNAL(activated(int)),
this, SLOT(change_adaptor()));
connect(langModule->languageCO, SIGNAL(activated(int)),
this, SLOT(languageChanged(int)));
connect(langModule->defaultencodingRB, SIGNAL(clicked()),
this, SLOT(change_adaptor()));
connect(langModule->otherencodingRB, SIGNAL(clicked()),
this, SLOT(change_adaptor()));
connect(langModule->encodingCO, SIGNAL(activated(int)),
this, SLOT(change_adaptor()));
connect(langModule->quoteStyleCO, SIGNAL(activated(int)),
this, SLOT(change_adaptor()));
connect(langModule->languagePackageCO, SIGNAL(activated(int)),
this, SLOT(change_adaptor()));
connect(langModule->languagePackageLE, SIGNAL(textChanged(QString)),
this, SLOT(change_adaptor()));
connect(langModule->languagePackageCO, SIGNAL(currentIndexChanged(int)),
this, SLOT(languagePackageChanged(int)));
connect(langModule->dynamicQuotesCB, SIGNAL(clicked()),
this, SLOT(change_adaptor()));
langModule->languagePackageLE->setValidator(new NoNewLineValidator(
langModule->languagePackageLE));
QAbstractItemModel * language_model = guiApp->languageModel();
// FIXME: it would be nice if sorting was enabled/disabled via a checkbox.
language_model->sort(0);
langModule->languageCO->setModel(language_model);
langModule->languageCO->setModelColumn(0);
// Always put the default encoding in the first position.
langModule->encodingCO->addItem(qt_("Language Default (no inputenc)"));
QStringList encodinglist;
for (auto const & encvar : encodings) {
if (!encvar.unsafe() && !encvar.guiName().empty())
encodinglist.append(qt_(encvar.guiName()));
}
encodinglist.sort();
langModule->encodingCO->addItems(encodinglist);
langModule->languagePackageCO->addItem(
qt_("Default"), toqstr("default"));
langModule->languagePackageCO->addItem(
qt_("Automatic"), toqstr("auto"));
langModule->languagePackageCO->addItem(
qt_("Always Babel"), toqstr("babel"));
langModule->languagePackageCO->addItem(
qt_("Custom"), toqstr("custom"));
langModule->languagePackageCO->addItem(
qt_("None[[language package]]"), toqstr("none"));
// fonts
fontModule = new FontModule(this);
connect(fontModule->osFontsCB, SIGNAL(clicked()),
@ -904,9 +960,9 @@ GuiDocument::GuiDocument(GuiView & lv)
fontModule->fontsizeCO->addItem(qt_("11"));
fontModule->fontsizeCO->addItem(qt_("12"));
fontModule->fontencCO->addItem(qt_("Default"), QString("global"));
fontModule->fontencCO->addItem(qt_("Automatic"), QString("auto"));
fontModule->fontencCO->addItem(qt_("Class default"), QString("default"));
fontModule->fontencCO->addItem(qt_("Custom"), QString("custom"));
fontModule->fontencCO->addItem(qt_("None (no fontenc)"), QString("default"));
for (int n = 0; GuiDocument::fontfamilies_gui[n][0]; ++n)
fontModule->fontsDefaultCO->addItem(
@ -1071,60 +1127,6 @@ GuiDocument::GuiDocument(GuiView & lv)
marginsModule->columnsepL);
// language & quote
langModule = new UiWidget<Ui::LanguageUi>(this);
connect(langModule->languageCO, SIGNAL(activated(int)),
this, SLOT(change_adaptor()));
connect(langModule->languageCO, SIGNAL(activated(int)),
this, SLOT(languageChanged(int)));
connect(langModule->defaultencodingRB, SIGNAL(clicked()),
this, SLOT(change_adaptor()));
connect(langModule->otherencodingRB, SIGNAL(clicked()),
this, SLOT(change_adaptor()));
connect(langModule->encodingCO, SIGNAL(activated(int)),
this, SLOT(change_adaptor()));
connect(langModule->quoteStyleCO, SIGNAL(activated(int)),
this, SLOT(change_adaptor()));
connect(langModule->languagePackageCO, SIGNAL(activated(int)),
this, SLOT(change_adaptor()));
connect(langModule->languagePackageLE, SIGNAL(textChanged(QString)),
this, SLOT(change_adaptor()));
connect(langModule->languagePackageCO, SIGNAL(currentIndexChanged(int)),
this, SLOT(languagePackageChanged(int)));
connect(langModule->dynamicQuotesCB, SIGNAL(clicked()),
this, SLOT(change_adaptor()));
langModule->languagePackageLE->setValidator(new NoNewLineValidator(
langModule->languagePackageLE));
QAbstractItemModel * language_model = guiApp->languageModel();
// FIXME: it would be nice if sorting was enabled/disabled via a checkbox.
language_model->sort(0);
langModule->languageCO->setModel(language_model);
langModule->languageCO->setModelColumn(0);
// Always put the default encoding in the first position.
langModule->encodingCO->addItem(qt_("Language Default (no inputenc)"));
QStringList encodinglist;
for (auto const & encvar : encodings) {
if (!encvar.unsafe() && !encvar.guiName().empty())
encodinglist.append(qt_(encvar.guiName()));
}
encodinglist.sort();
langModule->encodingCO->addItems(encodinglist);
langModule->languagePackageCO->addItem(
qt_("Default"), toqstr("default"));
langModule->languagePackageCO->addItem(
qt_("Automatic"), toqstr("auto"));
langModule->languagePackageCO->addItem(
qt_("Always Babel"), toqstr("babel"));
langModule->languagePackageCO->addItem(
qt_("Custom"), toqstr("custom"));
langModule->languagePackageCO->addItem(
qt_("None[[language package]]"), toqstr("none"));
// color
colorModule = new UiWidget<Ui::ColorUi>(this);
connect(colorModule->fontColorPB, SIGNAL(clicked()),
@ -2151,8 +2153,13 @@ bool GuiDocument::ot1() const
{
QString const fontenc =
fontModule->fontencCO->itemData(fontModule->fontencCO->currentIndex()).toString();
int const i = langModule->languageCO->currentIndex();
if (i == -1)
return false;
QString const langname = langModule->languageCO->itemData(i).toString();
Language const * newlang = lyx::languages.getLanguage(fromqstr(langname));
return (fontenc == "default"
|| (fontenc == "global" && (lyxrc.fontenc == "default" || lyxrc.fontenc == "OT1"))
|| (fontenc == "auto" && newlang->fontenc(buffer().params()) == "OT1")
|| (fontenc == "custom" && fontModule->fontencLE->text() == "OT1"));
}
@ -3837,12 +3844,13 @@ void GuiDocument::paramsToDialog()
if (nn >= 0)
fontModule->fontsDefaultCO->setCurrentIndex(nn);
if (bp_.fontenc == "global" || bp_.fontenc == "default") {
if (bp_.fontenc == "auto" || bp_.fontenc == "default") {
fontModule->fontencCO->setCurrentIndex(
fontModule->fontencCO->findData(toqstr(bp_.fontenc)));
fontModule->fontencLE->setEnabled(false);
} else {
fontModule->fontencCO->setCurrentIndex(1);
fontModule->fontencCO->setCurrentIndex(
fontModule->fontencCO->findData("custom"));
fontModule->fontencLE->setText(toqstr(bp_.fontenc));
}

View File

@ -725,7 +725,6 @@ PrefLatex::PrefLatex(GuiPreferences * form)
{
setupUi(this);
latexEncodingED->setValidator(new NoNewLineValidator(latexEncodingED));
latexDviPaperED->setValidator(new NoNewLineValidator(latexDviPaperED));
latexBibtexED->setValidator(new NoNewLineValidator(latexBibtexED));
latexJBibtexED->setValidator(new NoNewLineValidator(latexJBibtexED));
@ -734,10 +733,6 @@ PrefLatex::PrefLatex(GuiPreferences * form)
latexNomenclED->setValidator(new NoNewLineValidator(latexNomenclED));
latexChecktexED->setValidator(new NoNewLineValidator(latexChecktexED));
connect(latexEncodingCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(latexEncodingED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
connect(latexChecktexED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
connect(latexBibtexCO, SIGNAL(activated(int)),
@ -771,12 +766,6 @@ PrefLatex::PrefLatex(GuiPreferences * form)
}
void PrefLatex::on_latexEncodingCB_stateChanged(int state)
{
latexEncodingED->setEnabled(state == Qt::Checked);
}
void PrefLatex::on_latexBibtexCO_activated(int n)
{
QString const bibtex = latexBibtexCO->itemData(n).toString();
@ -890,10 +879,6 @@ void PrefLatex::applyRC(LyXRC & rc) const
else
rc.index_command = fromqstr(index) + " " + fromqstr(idxopt);
if (latexEncodingCB->isChecked())
rc.fontenc = fromqstr(latexEncodingED->text());
else
rc.fontenc = "default";
rc.chktex_command = fromqstr(latexChecktexED->text());
rc.jindex_command = fromqstr(latexJIndexED->text());
rc.nomencl_command = fromqstr(latexNomenclED->text());
@ -990,14 +975,6 @@ void PrefLatex::updateRC(LyXRC const & rc)
latexIndexOptionsLA->setText(qt_("Co&mmand:"));
}
if (rc.fontenc == "default") {
latexEncodingCB->setChecked(false);
latexEncodingED->setEnabled(false);
} else {
latexEncodingCB->setChecked(true);
latexEncodingED->setEnabled(true);
latexEncodingED->setText(toqstr(rc.fontenc));
}
latexChecktexED->setText(toqstr(rc.chktex_command));
latexJIndexED->setText(toqstr(rc.jindex_command));
latexNomenclED->setText(toqstr(rc.nomencl_command));

View File

@ -214,7 +214,6 @@ public:
virtual void updateRC(LyXRC const & rc);
private Q_SLOTS:
void on_latexEncodingCB_stateChanged(int state);
void on_latexBibtexCO_activated(int n);
void on_latexJBibtexCO_activated(int n);
void on_latexIndexCO_activated(int n);

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>425</width>
<height>620</height>
<height>582</height>
</rect>
</property>
<property name="windowTitle">
@ -29,23 +29,6 @@
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QCheckBox" name="latexEncodingCB">
<property name="toolTip">
<string>Enable if a specific font encoding (such as T1) should be used (via fontenc)</string>
</property>
<property name="text">
<string>Use LaTe&amp;X font encoding:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="latexEncodingED">
<property name="toolTip">
<string>Specify the font encoding (e.g., T1).</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="latexDviPaperLA">
<property name="text">
<string>&amp;DVI viewer paper size options:</string>
@ -55,7 +38,7 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="0" column="1">
<widget class="QLineEdit" name="latexDviPaperED">
<property name="toolTip">
<string>Optional paper size flag (-paper) for some DVI viewers</string>
@ -85,7 +68,7 @@
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
<height>0</height>
</size>
</property>
</spacer>

View File

@ -630,7 +630,7 @@ InsetQuotes::InsetQuotes(Buffer * buf, char_type c, InsetQuotesParams::QuoteLeve
fontspec_ = buf->masterBuffer()->params().useNonTeXFonts;
} else {
global_style_ = InsetQuotesParams::EnglishQuotes;
fontenc_ = lyxrc.fontenc;
fontenc_ = "OT1";
fontspec_ = false;
}
if (style.empty())

View File

@ -1011,11 +1011,6 @@ void Preamble::handle_package(Parser &p, string const & name,
else if (name == "fontenc") {
h_fontencoding = getStringFromVector(options, ",");
/* We could do the following for better round trip support,
* but this makes the document less portable, so I skip it:
if (h_fontencoding == lyxrc.fontenc)
h_fontencoding = "global";
*/
options.clear();
}

View File

@ -32,8 +32,8 @@ extern char const * const lyx_version_info;
// Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own.
#define LYX_FORMAT_LYX 549 // spitz: \textcyr -> \textcyrillic
#define LYX_FORMAT_TEX2LYX 549
#define LYX_FORMAT_LYX 550 // spitz: \fontenc auto
#define LYX_FORMAT_TEX2LYX 550
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
#ifndef _MSC_VER