Am Freitag, 10. August 2018 18:06:00 CEST schrieb Jürgen Spitzmüller 
<sp...@lyx.org>:
> Am Freitag, den 10.08.2018, 18:01 +0200 schrieb Kornel Benko:
> > OK, this version works here
> 
> You also need to specify
> 
> ScaleOption      scaled=$$val

Did it, but too late.
The output was like
        % Added by lyx2lyx
        \usepackage{DejaVuSans}
        \usepackage[scaled=2.50]{DejaVuSans}

> in the sans and tt font definitions in order to make scaling setable in
> the GUI.
> 
> Jürgen

Here the modified patch

        Kornel

commit de899656c8afb694bede7b39c0454d8ace50131d
Author: Kornel Benko <kor...@lyx.org>
Date:   Fri Aug 10 18:20:22 2018 +0200

    Addeed support for DejaVu fonts in latex

diff --git a/development/FORMAT b/development/FORMAT
index cfd4302..4bf2519 100644
--- a/development/FORMAT
+++ b/development/FORMAT
@@ -5,10 +5,13 @@ Please keep the entries informative enough, i.e. try to indicate what
 changes happened in particular if possible. A good example would be
 2010-01-10 entry.
 
 -----------------------
 
+2018-08-10  Kornel Benko <kor...@lyx.org>
+	* format incremented to 561: Added DejaVu fonts
+
 2018-08-07  Jürgen Spitzmüller <sp...@lyx.org>
 	* format incremented to 560: Time-related info insets: time, modtime, fixtime;
           new buffer info inset type: name-noext.
 
 2018-08-04  Jürgen Spitzmüller <sp...@lyx.org>
diff --git a/lib/chkconfig.ltx b/lib/chkconfig.ltx
index 401406e..ac03ff8 100644
--- a/lib/chkconfig.ltx
+++ b/lib/chkconfig.ltx
@@ -443,10 +443,15 @@
 \TestPackage{ccfonts}
 \TestFont[ccr10]{concrete} % required by ccfonts
 \TestFont[eorm10]{ecc} % required by ccfonts
 \TestPackage[ot1ccr.fd]{concmath} % required by ccfonts
 \TestPackage{cmbright}
+\TestPackage{DejaVuSans}
+\TestPackage{DejaVuSansCondensed}
+\TestPackage{DejaVuSansMono}
+\TestPackage{DejaVuSerif}
+\TestPackage{DejaVuSerifCondensed}
 \TestPackage{eco}
 \TestPackage{eulervm}
 \TestPackage{feyn}
 \TestPackage{fourier}
 \TestPackage{garamondx}
diff --git a/lib/latexfonts b/lib/latexfonts
index f3a438a..77b080c 100644
--- a/lib/latexfonts
+++ b/lib/latexfonts
@@ -146,10 +146,22 @@ Font cmr
 	FontEncoding     OT1
 	SwitchDefault    1
 	OsfFont          eco
 EndFont
 
+Font DejaVuSerif
+	GuiName          "DejaVu Serif"
+	Family           rm
+	Package          DejaVuSerif
+EndFont
+
+Font DejaVuSerifCondensed
+	GuiName          "DejaVu Serif Condensed"
+	Family           rm
+	Package          DejaVuSerifCondensed
+EndFont
+
 AltFont eco
 	Family           rm
 	Package          eco
 EndFont
 
@@ -526,10 +538,22 @@ Font cmss
 	Family           sf
 	FontEncoding     OT1
 	SwitchDefault    1
 EndFont
 
+Font DejaVuSans
+	GuiName          "DejaVu Sans"
+	Family           sf
+	Package          DejaVuSans
+EndFont
+
+Font DejaVuSansCondensed
+	GuiName          "DejaVu Sans Condensed"
+	Family           sf
+	Package          DejaVuSansCondensed
+EndFont
+
 Font helvet
 	GuiName          "Helvetica"
 	Family           sf
 	ScaleOption      scaled=$$val
 	Package          helvet
@@ -631,11 +655,10 @@ Font uop
 	Family           sf
 	SwitchDefault    1
 	Requires         urwclassico
 EndFont
 
-
 #
 # MONOSPACED FONTS
 #
 
 Font beramono
@@ -665,10 +688,16 @@ Font courier
 	Family           tt
 	Package          courier
 	Requires         psnfss
 EndFont
 
+Font DejaVuSansMono
+	GuiName          "DejaVu Sans Mono"
+	Family           tt
+	Package          DejaVuSansMono
+EndFont
+
 Font libertine-mono
 	GuiName          "Libertine Mono"
 	Family           tt
 	ScaleOption      scaled=$$val
 	Package          libertineMono
diff --git a/lib/lyx2lyx/lyx_2_4.py b/lib/lyx2lyx/lyx_2_4.py
index 4d8e3da..b5c325f 100644
--- a/lib/lyx2lyx/lyx_2_4.py
+++ b/lib/lyx2lyx/lyx_2_4.py
@@ -49,10 +49,37 @@ from lyx2lyx_tools import (put_cmd_in_ert, add_to_preamble)
 ###
 ### Conversion and reversion routines
 ###
 ###############################################################################
 
+def revert_dejavu(document):
+    " Revert native DejaVu font definition to LaTeX "
+
+    if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1:
+        dejavu_fonts = ['DejaVuSerif', 'DejaVuSerifCondensed', 'DejaVuSans',
+                         'DejaVuSansMono', 'DejaVuSansCondensed']
+        font_types = ["\\font_roman", "\\font_sans,sf", "\\font_typewriter,tt"]
+        for ft1 in font_types:
+            fts = ft1.split(",")
+            ft = fts[0]
+            i = find_token(document.header, ft, 0)
+            if i != -1:
+                val = get_value(document.header, ft, i)
+                words = val.split()
+                val = words[0].replace('"', '')
+                if val in dejavu_fonts:
+                    xoption = ""
+                    document.header[i] = ft + ' "default" ' + words[1]
+                    if len(fts) > 1:
+                        xval =  get_value(document.header, "\\font_" + fts[1] + "_scale", 0)
+                        # cutoff " 100"
+                        xval = xval[:-4]
+                        if xval != "100":
+                            xoption = "[scaled=" + format(float(xval) / 100, '.2f') + "]"
+                    preamble = "\\usepackage" + xoption + "{%s}" % val
+                    add_to_preamble(document, [preamble])
+
 def removeFrontMatterStyles(document):
     " Remove styles Begin/EndFromatter"
 
     layouts = ['BeginFrontmatter', 'EndFrontmatter']
     for layout in layouts:
@@ -1069,14 +1096,16 @@ convert = [
            [555, []],
            [556, []],
            [557, [convert_vcsinfo]],
            [558, [removeFrontMatterStyles]],
            [559, []],
-           [560, []]
+           [560, []],
+           [561, []]
           ]
 
 revert =  [
+           [560, [revert_dejavu]],
            [559, [revert_timeinfo, revert_namenoextinfo]],
            [558, [revert_dateinfo]],
            [557, [addFrontMatterStyles]],
            [556, [revert_vcsinfo]],
            [555, [revert_bibencoding]],

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to