Re: DejaVu fonts latex

2018-08-10 Thread Kornel Benko
Am Freitag, 10. August 2018 19:35:35 CEST schrieb Jürgen Spitzmüller 
:
> Am Freitag, den 10.08.2018, 19:20 +0200 schrieb Kornel Benko:
> > OK. Now that it works, I wonder why do we restrict the scaling to
> > 200% in the GUI?
> > Setting the scale value with an external editor to say 500, it still
> > displays nice.
> 
> But does this make sense? This is only to adjust different fonts.

Not for adjustment only, no. But latex allows it.

> Jürgen

Kornel


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


Re: DejaVu fonts latex

2018-08-10 Thread Jürgen Spitzmüller
Am Freitag, den 10.08.2018, 19:20 +0200 schrieb Kornel Benko:
> OK. Now that it works, I wonder why do we restrict the scaling to
> 200% in the GUI?
> Setting the scale value with an external editor to say 500, it still
> displays nice.

But does this make sense? This is only to adjust different fonts.

Jürgen

> 
>   Kornel


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


Re: DejaVu fonts latex

2018-08-10 Thread Kornel Benko
Am Freitag, 10. August 2018 19:05:05 CEST schrieb Jürgen Spitzmüller 
:
> Am Freitag, den 10.08.2018, 18:44 +0200 schrieb Kornel Benko:
> > Ah, thanks, I missed that.
> > 
> > Added now. Commit?
> 
> Yes, but please also add some notes to development/FORMATS as well as
> tex2lyx/todo.
> 
> Jürgen
> 

OK. Now that it works, I wonder why do we restrict the scaling to 200% in the 
GUI?
Setting the scale value with an external editor to say 500, it still displays 
nice.

Kornel

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


Re: DejaVu fonts latex

2018-08-10 Thread Jürgen Spitzmüller
Am Freitag, den 10.08.2018, 18:44 +0200 schrieb Kornel Benko:
> Ah, thanks, I missed that.
> 
> Added now. Commit?

Yes, but please also add some notes to development/FORMATS as well as
tex2lyx/todo.

Jürgen

> 
> > Jürgen
> 
>   Kornel


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


Re: DejaVu fonts latex

2018-08-10 Thread Kornel Benko
Am Freitag, 10. August 2018 18:38:34 CEST schrieb Jürgen Spitzmüller 
:
> Am Freitag, den 10.08.2018, 18:27 +0200 schrieb Kornel Benko:
> > Am Freitag, 10. August 2018 18:06:00 CEST schrieb Jürgen Spitzmüller
> > :
> > > 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.
> 
> Still not in the patch.
> 
> Note that I am talking about latexfonts, not lyx2lyx.

Ah, thanks, I missed that.

Added now. Commit?

> Jürgen

Kornel


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


Re: DejaVu fonts latex

2018-08-10 Thread Jürgen Spitzmüller
Am Freitag, den 10.08.2018, 18:27 +0200 schrieb Kornel Benko:
> Am Freitag, 10. August 2018 18:06:00 CEST schrieb Jürgen Spitzmüller
> :
> > 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.

Still not in the patch.

Note that I am talking about latexfonts, not lyx2lyx.

Jürgen


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


Re: DejaVu fonts latex

2018-08-10 Thread Kornel Benko
Am Freitag, 10. August 2018 18:06:00 CEST schrieb Jürgen Spitzmüller 
:
> 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 
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 
+	* format incremented to 561: Added DejaVu fonts
+
 2018-08-07  Jürgen Spitzmüller 
 	* 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 
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
 	SwitchDefault1
 	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
 	SwitchDefault1
 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
 	SwitchDefault1
 	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":
+xop

Re: DejaVu fonts latex

2018-08-10 Thread Jürgen Spitzmüller
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

in the sans and tt font definitions in order to make scaling setable in
the GUI.

Jürgen

> 
>   Kornel


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


Re: DejaVu fonts latex

2018-08-10 Thread Kornel Benko
Am Freitag, 10. August 2018 17:12:31 CEST schrieb Jürgen Spitzmüller 
:
> Am Freitag, den 10.08.2018, 15:41 +0200 schrieb Kornel Benko:
> > Would the following work? And is it OK to not have the conversion
> > routine?
> 
> Yes.
> 
> > ###
> > 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",
> > "\\font_typewriter"]
> > for ft in font_types:
> > i = find_token(document.header, ft, 0)
> > if i != -1:
> > val = get_value(document.header, ft, i)
> > if val in dejavu_fonts:
> > preamble = "\\usepackage{%s}" % val
> > add_to_preamble(document, [preamble])
> > document.header[i] =
> > document.header[i].replace(val, "default")
> 
> Looks good. But don't you want to support the scaled option of the
> package?
> 
> > ###
> > 
> > Also looking into lyx_2_4.py
> > revert =  [
> >[558, [revert_timeinfo, revert_namenoextinfo]],
> >[558, [revert_dateinfo]],
> > ...
> > looks wrong (2 times 558). Do I miss something here?
> 
> Fixed. Thanks.
> 

OK, this version works here

Kornel
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 
+	* format incremented to 561: Added DejaVu fonts
+
 2018-08-07  Jürgen Spitzmüller 
 	* 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 
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
 	SwitchDefault1
 	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
 	SwitchDefault1
 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
 	SwitchDefault1
 	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..c8e5811 100644
--- a/lib/lyx2lyx/lyx_2_4.py
+++ b/lib/lyx2lyx/lyx_2_4.py
@@ -49,10 +49,42 @@ 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

Re: DejaVu fonts latex

2018-08-10 Thread Jürgen Spitzmüller
Am Freitag, den 10.08.2018, 15:41 +0200 schrieb Kornel Benko:
> Would the following work? And is it OK to not have the conversion
> routine?

Yes.

> ###
> 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",
> "\\font_typewriter"]
> for ft in font_types:
> i = find_token(document.header, ft, 0)
> if i != -1:
> val = get_value(document.header, ft, i)
> if val in dejavu_fonts:
> preamble = "\\usepackage{%s}" % val
> add_to_preamble(document, [preamble])
> document.header[i] =
> document.header[i].replace(val, "default")

Looks good. But don't you want to support the scaled option of the
package?

> ###
> 
> Also looking into lyx_2_4.py
> revert =  [
>[558, [revert_timeinfo, revert_namenoextinfo]],
>[558, [revert_dateinfo]],
> ...
> looks wrong (2 times 558). Do I miss something here?

Fixed. Thanks.

Jürgen

> 
>   Kornel


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


Re: DejaVu fonts latex

2018-08-10 Thread Kornel Benko
Am Freitag, 10. August 2018 14:58:41 CEST schrieb Jürgen Spitzmüller 
:
> Am Freitag, den 10.08.2018, 14:50 +0200 schrieb Kornel Benko:
> > What is the reason to not include them in lyx?
> > Is it because we can use Bera instead?
> 
> Because nobody did it.
> 
> Don't forget the file format change.
> 
> Jürgen
> 
> > 
> > Kornel
> 

Would the following work? And is it OK to not have the conversion routine?
###
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", "\\font_typewriter"]
for ft in font_types:
i = find_token(document.header, ft, 0)
if i != -1:
val = get_value(document.header, ft, i)
if val in dejavu_fonts:
preamble = "\\usepackage{%s}" % val
add_to_preamble(document, [preamble])
document.header[i] = document.header[i].replace(val, 
"default")
###

Also looking into lyx_2_4.py
revert =  [
   [558, [revert_timeinfo, revert_namenoextinfo]],
   [558, [revert_dateinfo]],
...
looks wrong (2 times 558). Do I miss something here?

Kornel


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


Re: DejaVu fonts latex

2018-08-10 Thread Jürgen Spitzmüller
Am Freitag, den 10.08.2018, 14:50 +0200 schrieb Kornel Benko:
> What is the reason to not include them in lyx?
> Is it because we can use Bera instead?

Because nobody did it.

Don't forget the file format change.

Jürgen

> 
>   Kornel


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