[LyX/master] Fix typo (from Thibaut)

2020-05-08 Thread Richard Kimberly Heck
commit b1a0f7ac544f05846f64ec49dd5588c78085a57e
Author: Richard Kimberly Heck 
Date:   Fri May 8 13:32:08 2020 -0400

Fix typo (from Thibaut)
---
 src/graphics/PreviewLoader.cpp |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/graphics/PreviewLoader.cpp b/src/graphics/PreviewLoader.cpp
index d9133d9..7d72c1d 100644
--- a/src/graphics/PreviewLoader.cpp
+++ b/src/graphics/PreviewLoader.cpp
@@ -689,7 +689,7 @@ void PreviewLoader::Impl::startLoading(bool wait)
}
dumpPreamble(os, flavor);
// handle inputenc etc.
-   // I think, this is already hadled by dumpPreamble(): Kornel
+   // I think this is already handled by dumpPreamble(): Kornel
// buffer_.params().writeEncodingPreamble(os, features);
of << "\n\\begin{document}\n";
dumpData(of, inprogress.snippets);
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Python cleanup from Thibaut.

2020-05-08 Thread Richard Kimberly Heck
commit 5588c22e778b6e96a9c272a8b6a7ee637b9446c9
Author: Richard Kimberly Heck 
Date:   Fri May 8 13:31:05 2020 -0400

Python cleanup from Thibaut.
---
 lib/lyx2lyx/lyx_2_4.py |  104 +++-
 1 files changed, 50 insertions(+), 54 deletions(-)

diff --git a/lib/lyx2lyx/lyx_2_4.py b/lib/lyx2lyx/lyx_2_4.py
index d32ff79..cf4e91b 100644
--- a/lib/lyx2lyx/lyx_2_4.py
+++ b/lib/lyx2lyx/lyx_2_4.py
@@ -47,7 +47,7 @@ from lyx2lyx_tools import (put_cmd_in_ert, add_to_preamble, 
insert_to_preamble,
 # Private helper functions
 
 def add_preamble_fonts(document, fontmap):
-" Add collected font-packages with their option to user-preamble"
+"""Add collected font-packages with their option to user-preamble"""
 
 for pkg in fontmap:
 if len(fontmap[pkg]) > 0:
@@ -85,7 +85,7 @@ class fontmapping:
 self.pkginmap = dict()  # defines, if a map for package exists
 
 def expandFontMapping(self, font_list, font_type, scale_type, pkg, 
scaleopt = None, osfopt = None, osfdef = "false"):
-" Expand fontinfo mapping"
+"""Expand fontinfo mapping"""
 #
 # fontlist:list of fontnames, each element
 #  may contain a ','-separated list of needed options
@@ -197,8 +197,7 @@ def createFontMapping(fontlist):
 return fm
 
 def convert_fonts(document, fm, osfoption = "osf"):
-" Handle font definition (LaTeX preamble -> native) "
-
+"""Handle font definition (LaTeX preamble -> native)"""
 rpkg = re.compile(r'^\\usepackage(\[([^\]]*)\])?\{([^\}]+)\}')
 rscaleopt = re.compile(r'^scaled?=(.*)')
 
@@ -306,9 +305,8 @@ def convert_fonts(document, fm, osfoption = "osf"):
 document.header.insert(fo, fotag + " \"" + 
",".join(options) + "\"")
 
 
-
 def revert_fonts(document, fm, fontmap, OnlyWithXOpts = False, WithXOpts = 
False):
-" Revert native font definition to LaTeX "
+"""Revert native font definition to LaTeX"""
 # fonlist := list of fonts created from the same package
 # Empty package means that the font-name is the same as the package-name
 # fontmap (key = package, val += found options) will be filled
@@ -390,7 +388,7 @@ def revert_fonts(document, fm, fontmap, OnlyWithXOpts = 
False, WithXOpts = False
 ###
 
 def convert_inputencoding_namechange(document):
-" Rename inputencoding settings. "
+"""Rename inputencoding settings."""
 i = find_token(document.header, "\\inputencoding", 0)
 if i == -1:
 return
@@ -398,7 +396,7 @@ def convert_inputencoding_namechange(document):
 document.header[i] = s.replace("default", "auto-legacy-plain")
 
 def revert_inputencoding_namechange(document):
-" Rename inputencoding settings. "
+"""Rename inputencoding settings."""
 i = find_token(document.header, "\\inputencoding", 0)
 if i == -1:
 return
@@ -406,14 +404,14 @@ def revert_inputencoding_namechange(document):
 document.header[i] = s.replace("auto-legacy", "auto")
 
 def convert_notoFonts(document):
-" Handle Noto fonts definition to LaTeX "
+"""Handle Noto fonts definition to LaTeX"""
 
 if not get_bool_value(document.header, "\\use_non_tex_fonts"):
 fm = createFontMapping(['Noto'])
 convert_fonts(document, fm)
 
 def revert_notoFonts(document):
-" Revert native Noto font definition to LaTeX "
+"""Revert native Noto font definition to LaTeX"""
 
 if not get_bool_value(document.header, "\\use_non_tex_fonts"):
 fontmap = dict()
@@ -422,14 +420,14 @@ def revert_notoFonts(document):
 add_preamble_fonts(document, fontmap)
 
 def convert_latexFonts(document):
-" Handle DejaVu and IBMPlex fonts definition to LaTeX "
+"""Handle DejaVu and IBMPlex fonts definition to LaTeX"""
 
 if not get_bool_value(document.header, "\\use_non_tex_fonts"):
 fm = createFontMapping(['DejaVu', 'IBM'])
 convert_fonts(document, fm)
 
 def revert_latexFonts(document):
-" Revert native DejaVu font definition to LaTeX "
+"""Revert native DejaVu font definition to LaTeX"""
 
 if not get_bool_value(document.header, "\\use_non_tex_fonts"):
 fontmap = dict()
@@ -438,14 +436,14 @@ def revert_latexFonts(document):
 add_preamble_fonts(document, fontmap)
 
 def convert_AdobeFonts(document):
-" Handle Adobe Source fonts definition to LaTeX "
+"""Handle Adobe Source fonts definition to LaTeX"""
 
 if not get_bool_value(document.header, "\\use_non_tex_fonts"):
 fm = createFontMapping(['Adobe'])
 convert_fonts(document, fm)
 
 def revert_AdobeFonts(document):
-" Revert Adobe Source font definition to LaTeX "
+"""Revert Adobe Source font definition to LaTeX"""
 
 if not get_bool_value(document.header, "\\use_non_tex_fonts"):
 fontmap = dict()
@@ -454,7 +452,7 @@ def revert_AdobeFonts(document):
 

[LyX/master] Tools: optimize recognition of some font features in listFontWithLang.pl

2020-05-08 Thread Kornel Benko
commit 8918d5287b73f491f1d5aa03de2dd03f84920c76
Author: Kornel Benko 
Date:   Fri May 8 14:17:19 2020 +0200

Tools: optimize recognition of some font features in listFontWithLang.pl

Added (de)selecting fonts through its capability (latn, math, arab, etc)
Recognize also trebuchet in font name as sans-serif font
Recognize also fixed in font name as monospaced font
---
 development/tools/listFontWithLang.pl |   54 +
 1 files changed, 41 insertions(+), 13 deletions(-)

diff --git a/development/tools/listFontWithLang.pl 
b/development/tools/listFontWithLang.pl
index 5f88c66..95524df 100644
--- a/development/tools/listFontWithLang.pl
+++ b/development/tools/listFontWithLang.pl
@@ -58,12 +58,8 @@ my %optionsDef = (
   "nn"  => {fieldname => "NFontName",
 type => "=s", listsep => ',',
 comment => "Select font-names NOT matching these (comma 
separated) regexes"},
-  "ps"  => {fieldname => "Scripts", alias => ["printscripts"],
-comment => "Print supported scripts"},
   "pl"  => {fieldname => "PrintLangs", alias => ["printlangs"],
 comment => "Print supported languages"},
-  "pp"  => {fieldname => "PrintProperties", alias => ["printproperties"],
-comment => "Print properties from weight, slant and width"},
   "pf"  => {fieldname => "PrintFiles", alias => ["printfiles"],
 comment => "Print font file names"},
   "p"   => {fieldname => "Property",
@@ -72,6 +68,16 @@ my %optionsDef = (
   "np"  => {fieldname => "NProperty",
 type => "=s", listsep => ',',
 comment => "Select fonts with properties NOT matching these 
(comma separated) regexes"},
+  "pp"  => {fieldname => "PrintProperties", alias => ["printproperties"],
+comment => "Print properties from weight, slant and width"},
+  "s"   => {fieldname => "Scripts",
+type => "=s", listsep => ',',
+comment => "Select fonts with scripts matching these (comma 
separated) regexes"},
+  "ns"  => {fieldname => "NScripts",
+type => "=s", listsep => ',',
+comment => "Select fonts with scripts NOT matching these 
(comma separated) regexes"},
+  "ps"  => {fieldname => "PrintScripts", alias => ["printscripts"],
+comment => "Print supported scripts"},
   "pw"  => {fieldname => "PrintWarnings",
 comment => "Print warnings about discarded/overwritten fonts, 
conflicting styles"},
 );
@@ -93,7 +99,7 @@ if (defined($langs[0])) {
 
 my $format = "foundry=\"%{foundry}\" postscriptname=\"%{postscriptname}\" 
fn=\"%{fullname}\" fnl=\"%{fullnamelang}\" family=\"%{family}\" 
flang=\"%{familylang}\" style=\"%{style}\" stylelang=\"%{stylelang}\"";
 
-if (exists($options{Scripts})) {
+if (exists($options{PrintScripts}) || defined($options{Scripts}) || 
defined($options{NSpripts})) {
   $format .= " script=\"%{capability}\"";
 }
 if (exists($options{PrintLangs}) || defined($langs[0])) {
@@ -262,21 +268,42 @@ if (open(FI,  "$cmd |")) {
 }
   }
   if (exists($options{PrintProperties})) {
-$props .= "($properties)";
+$props .= " ($properties)";
   }
 }
 
 if (exists($options{PrintLangs})) {
   $props .= '(' . join(',', sort keys %usedlangs) . ')';
 }
-if (exists($options{Scripts})) {
+if (exists($options{PrintScripts}) || defined($options{Scripts}) || 
defined($options{NScripts})) {
+  my @scripts = ();
+  my $scripts = "";
   if ($l =~ / script=\"([^\"]+)\"/) {
-   my @scripts = split(/\s+/, $1);
+   @scripts = split(/\s+/, $1);
for my $ent (@scripts) {
  $ent =~ s/^\s*otlayout://;
  $ent = lc($ent);
}
-   $props .= '(' . join(',', @scripts) . ')';
+$scripts = join(',', @scripts);
+  }
+  if (exists($options{PrintScripts})) {
+$props .= "($scripts)";
+  }
+  if (!defined($scripts[0])) {
+# No script defined in font, so check only $options{Scripts}
+next NXTLINE if (defined($options{Scripts}));
+  }
+  else {
+if (defined($options{Scripts})) {
+  for my $s (@{$options{Scripts}}) {
+next NXTLINE if ($scripts !~ /$s/i);
+  }
+}
+if (defined($options{NScripts})) {
+  for my $s (@{$options{NScripts}}) {
+next NXTLINE if ($scripts =~ /$s/i);
+  }
+}
   }
 }
 my $foundry = "";
@@ -321,10 +348,11 @@ for my $fontname (sort keys %collectedfonts) {
 print "$err\n";
   }
 }
-print "Font : $fontname";
+my $fn = "Font : $fontname";
 if ($printfoundries && ($foundry ne "")) {
-  print " \[$foundry\]";
+  $fn .= " \[$foundry\]";
 }
+print $fn;
 print $collectedfonts{$fontname}->{$foundry}->{props};
 if (exists($options{PrintFiles})) {
   print ": " .