]> git.lyx.org Git - lyx.git/commitdiff
#9130 Text in main work area isn't rendered with high resolution
authorStephan Witt <switt@lyx.org>
Sat, 18 Oct 2014 13:30:58 +0000 (15:30 +0200)
committerStephan Witt <switt@lyx.org>
Sat, 18 Oct 2014 13:39:58 +0000 (15:39 +0200)
Add display_pixel_ratio to buffer params to use it for displays with high resolution.
It holds the highest ratio between physical pixels and device-independent pixels of the LyX application.
Preview snippets will be generated using this value to get high resolution preview.

src/Buffer.cpp
src/Buffer.h
src/BufferParams.cpp
src/BufferParams.h
src/graphics/PreviewImage.cpp
src/graphics/PreviewLoader.cpp
src/graphics/PreviewLoader.h

index cde0419b34746224b416a9c20b8f48061fd6b873..bfd1676cde6e398a7f1ae97a35f8130d82b48d2c 100644 (file)
@@ -659,6 +659,13 @@ BufferParams const & Buffer::masterParams() const
 }
 
 
+double Buffer::fontScalingFactor() const
+{
+       return isExporting() ? 75.0 * params().html_math_img_scale
+               : 0.01 * lyxrc.dpi * lyxrc.zoom * lyxrc.preview_scale_factor * params().display_pixel_ratio;
+}
+
+
 ParagraphList & Buffer::paragraphs()
 {
        return text().paragraphs();
index 29992f9ae78af32499bef78fffeabe5584137c75..ad6aeb8deb50bf057a0751bae84ede033e7a96a0 100644 (file)
@@ -236,6 +236,8 @@ public:
        /// read the header, returns number of unknown tokens
        int readHeader(Lexer & lex);
 
+       double fontScalingFactor() const;
+
 private:
        ///
        typedef std::map<Buffer const *, Buffer *> BufferMap;
index 8ae249ea23cea84b05d2be4450c06c31be382a1f..01927a74cf6bdc2fcf201c0c1c8757923f0014bd 100644 (file)
@@ -417,6 +417,7 @@ BufferParams::BufferParams()
        html_math_output = MathML;
        html_math_img_scale = 1.0;
        html_css_as_file = false;
+       display_pixel_ratio = 1.0;
 
        output_sync = false;
        use_refstyle = true;
index 2d7c749eea361f882672d416e75b36560510d120..a3836a80c21695284d2fe4d793cf69fff4309438 100644 (file)
@@ -465,6 +465,8 @@ public:
        ///
        double html_math_img_scale;
        ///
+       double display_pixel_ratio;
+       ///
        std::string html_latex_start;
        ///
        std::string html_latex_end;
index 31853655e5aea9dcf43f261e3a46a139e065a65e..5eecfcc48a8f1a7add5a059b1726c9414e48ae10 100644 (file)
@@ -105,6 +105,7 @@ PreviewImage::Impl::Impl(PreviewImage & p, PreviewLoader & l,
        : parent_(p), ploader_(l), iloader_(bf),
          snippet_(s), ascent_frac_(af)
 {
+       iloader_.setDisplayPixelRatio(l.displayPixelRatio());
        iloader_.connect(bind(&Impl::statusChanged, this));
 }
 
index f39bd8ee1d67c88f70612b22efe7cc91110be555..6e392e5f36af0ef3f8f3ecf6e81b081828a6ffdc 100644 (file)
@@ -581,9 +581,7 @@ void PreviewLoader::Impl::startLoading(bool wait)
                return;
        }
 
-       double const font_scaling_factor = 
-               buffer_.isExporting() ? 75.0 * buffer_.params().html_math_img_scale 
-                       : 0.01 * lyxrc.dpi * lyxrc.zoom * lyxrc.preview_scale_factor;
+       double const font_scaling_factor = buffer_.fontScalingFactor();
        
        // The conversion command.
        ostringstream cs;
@@ -650,6 +648,11 @@ void PreviewLoader::Impl::startLoading(bool wait)
 }
 
 
+double PreviewLoader::displayPixelRatio() const
+{
+       return buffer().params().display_pixel_ratio;
+}
+
 void PreviewLoader::Impl::finishedGenerating(pid_t pid, int retval)
 {
        // Paranoia check!
index 6910984c9ed13eb77c851ac49ee3bad94403fd4d..23af0138866b3377b2be1546d4b3556303a66318 100644 (file)
@@ -91,6 +91,8 @@ public:
        /// The foreground color used
        static ColorCode foregroundColor() { return Color_preview; }
 
+       double displayPixelRatio() const ;
+
 private:
        /// noncopyable
        PreviewLoader(PreviewLoader const &);