fm.expandFontMapping(['ADOBESourceSerifPro'], "roman", None, "sourceserifpro")
fm.expandFontMapping(['ADOBESourceSansPro'], "sans", "sf", "sourcesanspro", "scaled")
fm.expandFontMapping(['ADOBESourceCodePro'], "typewriter", "tt", "sourcecodepro", "scaled")
+ elif font == 'Noto':
+ fm.expandFontMapping(['NotoSerifRegular,regular', 'NotoSerifMedium,medium',
+ 'NotoSerifThin,thin', 'NotoSerifLight,light',
+ 'NotoSerifExtralight,extralight'],
+ "roman", None, "noto-serif")
+ fm.expandFontMapping(['NotoSansRegular,regular', 'NotoSansMedium,medium',
+ 'NotoSansThin,thin', 'NotoSansLight,light',
+ 'NotoSansExtralight,extralight'],
+ "sans", "sf", "noto-sans", "scaled")
+ fm.expandFontMapping(['NotoMonoRegular'], "typewriter", "tt", "noto-mono", "scaled")
return fm
def convert_fonts(document, fm):
###
###############################################################################
+def convert_inputencoding_namechange(document):
+ " Rename inputencoding settings. "
+ i = find_token(document.header, "\\inputencoding", 0)
+ if i == -1:
+ return
+ s = document.header[i].replace("auto", "auto-legacy")
+ document.header[i] = s.replace("default", "auto-legacy-plain")
+
+def revert_inputencoding_namechange(document):
+ " Rename inputencoding settings. "
+ i = find_token(document.header, "\\inputencoding", 0)
+ if i == -1:
+ return
+ s = document.header[i].replace("auto-legacy-plain", "default")
+ document.header[i] = s.replace("auto-legacy", "auto")
+
+def convert_notoFonts(document):
+ " Handle Noto fonts definition to LaTeX "
+
+ if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1:
+ fm = createFontMapping(['Noto'])
+ convert_fonts(document, fm)
+
+def revert_notoFonts(document):
+ " Revert native Noto font definition to LaTeX "
+
+ if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1:
+ fontmap = dict()
+ fm = createFontMapping(['Noto'])
+ revert_fonts(document, fm, fontmap)
+ add_preamble_fonts(document, fontmap)
+
def convert_latexFonts(document):
" Handle DejaVu and IBMPlex fonts definition to LaTeX "
def convert_hebrew_parentheses(document):
- " Don't reverse parentheses in Hebrew text"
- current_language = document.language
+ """ Swap opening/closing parentheses in Hebrew text.
+
+ Up to LyX 2.4, ")" was used as opening parenthesis and
+ "(" as closing parenthesis for Hebrew in the LyX source.
+ """
+
+ print("convert hebrew parentheses")
+ current_languages = [document.language]
for i, line in enumerate(document.body):
if line.startswith('\\lang '):
- current_language = line[len('\\lang '):]
+ current_languages[-1] = line.lstrip('\\lang ')
+ elif line.startswith('\\begin_layout'):
+ current_languages.append(current_languages[-1])
+ print (line, current_languages[-1])
elif line.startswith('\\end_layout'):
- current_language = document.language
- elif current_language == 'hebrew' and not line.startswith('\\'):
+ current_languages.pop()
+ elif current_languages[-1] == 'hebrew' and not line.startswith('\\'):
document.body[i] = line.replace('(','\x00').replace(')','(').replace('\x00',')')
[568, []],
[569, []],
[570, []],
- [571, []]
+ [571, []],
+ [572, [convert_notoFonts]], # Added options thin, light, extralight for Noto
+ [573, [convert_inputencoding_namechange]],
]
-revert = [
+revert = [[572, [revert_inputencoding_namechange]],
+ [571, [revert_notoFonts]],
[570, [revert_cmidruletrimming]],
[569, [revert_bibfileencodings]],
[568, [revert_tablestyle]],