Improving LaTeX rendering DPI.
This commit is contained in:
parent
98f26d4919
commit
43d78e17e5
1 changed files with 5 additions and 1 deletions
|
@ -86,7 +86,7 @@ class Latex(QObject):
|
||||||
Prepares and renders a latex string into a png file.
|
Prepares and renders a latex string into a png file.
|
||||||
"""
|
"""
|
||||||
markup_hash = hash(latex_markup)
|
markup_hash = hash(latex_markup)
|
||||||
export_path = path.join(self.tempdir.name, f'{markup_hash}_{font_size}_{color.rgb()}')
|
export_path = path.join(self.tempdir.name, f'{markup_hash}_{int(font_size)}_{color.rgb()}')
|
||||||
if self.latexSupported and not path.exists(export_path + ".png"):
|
if self.latexSupported and not path.exists(export_path + ".png"):
|
||||||
print("Rendering", latex_markup, export_path)
|
print("Rendering", latex_markup, export_path)
|
||||||
# Generating file
|
# Generating file
|
||||||
|
@ -97,7 +97,11 @@ class Latex(QObject):
|
||||||
self.create_latex_doc(latex_path, latex_markup)
|
self.create_latex_doc(latex_path, latex_markup)
|
||||||
self.convert_latex_to_dvi(latex_path)
|
self.convert_latex_to_dvi(latex_path)
|
||||||
self.cleanup(latex_path)
|
self.cleanup(latex_path)
|
||||||
|
# Creating four pictures of different sizes to better handle dpi.
|
||||||
self.convert_dvi_to_png(latex_path, export_path, font_size, color)
|
self.convert_dvi_to_png(latex_path, export_path, font_size, color)
|
||||||
|
self.convert_dvi_to_png(latex_path, export_path+"@2", font_size*2, color)
|
||||||
|
self.convert_dvi_to_png(latex_path, export_path+"@3", font_size*3, color)
|
||||||
|
self.convert_dvi_to_png(latex_path, export_path+"@4", font_size*4, color)
|
||||||
except Exception as e: # One of the processes failed. A message will be sent every time.
|
except Exception as e: # One of the processes failed. A message will be sent every time.
|
||||||
raise e
|
raise e
|
||||||
img = QImage(export_path);
|
img = QImage(export_path);
|
||||||
|
|
Loading…
Reference in a new issue