]> git.pld-linux.org Git - packages/libreoffice.git/blob - openoffice-gui-font-scale.patch
- DON'T hardcode java paths!
[packages/libreoffice.git] / openoffice-gui-font-scale.patch
1
2         We have to use Xft's hard-coded idea of the dpi first, and use
3 the builtin toDouble to avoid l10n issues.
4
5 --- vcl/unx/source/app/saldisp.cxx      8 Aug 2002 02:49:59 -0000       1.31.2.3
6 +++ vcl/unx/source/app/saldisp.cxx      14 Jan 2003 20:17:05 -0000
7 @@ -833,9 +833,20 @@
8      pVisual_            = new SalVisual( pXVI );
9      aSize_              = Size( DisplayWidth ( pDisp_, nScreen_ ),
10                                  DisplayHeight( pDisp_, nScreen_ ) );
11 -    aResolution_        =
12 +    {
13 +      const char *value;
14 +      long dpi = 0;
15 +      if ((value = XGetDefault (pDisp_, "Xft", "dpi"))) {
16 +       ::rtl::OString str (value);
17 +       dpi = (long) str.toDouble();
18 +      }
19 +      if (dpi > 0)
20 +        aResolution_ = Pair( dpi, dpi );
21 +      else
22 +       aResolution_ =
23          Pair( DPI( aSize_.Width(),  DisplayWidthMM ( pDisp_, nScreen_ ) ),
24                DPI( aSize_.Height(), DisplayHeightMM( pDisp_, nScreen_ ) ) );
25 +    }
26  
27      nMaxRequestSize_    = XExtendedMaxRequestSize( pDisp_ ) * 4;
28      if( !nMaxRequestSize_ )
29
30
31
32 Index: vcl/source/window/window.cxx
33 ===================================================================
34 RCS file: /cvs/gsl/vcl/source/window/window.cxx,v
35 retrieving revision 1.176
36 diff -u -3 -p -r1.176 window.cxx
37 --- vcl/source/window/window.cxx        1 Jul 2003 14:48:37 -0000       1.176
38 +++ vcl/source/window/window.cxx        7 Nov 2003 16:01:31 -0000
39 @@ -1659,6 +1659,7 @@ void Window::ImplInitResolutionSettings(
40  }
41  
42  // -----------------------------------------------------------------------
43 +#include <stdio.h>
44  
45  void Window::ImplPointToLogic( Font& rFont ) const
46  {
47 @@ -1667,17 +1668,21 @@ void Window::ImplPointToLogic( Font& rFo
48  
49      if ( aSize.Width() )
50      {
51 -        aSize.Width() *= mpFrameData->mnFontDPIX;
52 -        aSize.Width() += 72/2;
53 -        aSize.Width() /= 72;
54 -        aSize.Width() *= nScreenFontZoom;
55 -        aSize.Width() /= 100;
56 -    }
57 -    aSize.Height() *= mpFrameData->mnFontDPIY;
58 -    aSize.Height() += 72/2;
59 -    aSize.Height() /= 72;
60 -    aSize.Height() *= nScreenFontZoom;
61 -    aSize.Height() /= 100;
62 +               double t = aSize.Width();
63 +               t *= nScreenFontZoom;
64 +               t /= 100.0;
65 +               t *= mpFrameData->mnFontDPIX;
66 +               t /= 72.0;
67 +               t += 0.5;
68 +               aSize.Width() = (long) t;
69 +    }
70 +    double t = aSize.Height();
71 +    t *= nScreenFontZoom;
72 +    t /= 100.0;
73 +    t *= mpFrameData->mnFontDPIY;
74 +    t /= 72.0;
75 +    t += 0.5;
76 +    aSize.Height() = (long) t;
77  
78      if ( IsMapModeEnabled() )
79          aSize = PixelToLogic( aSize );
80 @@ -1697,17 +1702,22 @@ void Window::ImplLogicToPoint( Font& rFo
81  
82      if ( aSize.Width() )
83      {
84 -        aSize.Width() *= 100;
85 -        aSize.Width() /= nScreenFontZoom;
86 -        aSize.Width() *= 72;
87 -        aSize.Width() += mpFrameData->mnFontDPIX/2;
88 -        aSize.Width() /= mpFrameData->mnFontDPIX;
89 -    }
90 -    aSize.Height() *= 100;
91 -    aSize.Height() /= nScreenFontZoom;
92 -    aSize.Height() *= 72;
93 -    aSize.Height() += mpFrameData->mnFontDPIY/2;
94 -    aSize.Height() /= mpFrameData->mnFontDPIY;
95 +               double t = aSize.Width();
96 +               t -= 0.5;
97 +               t *= 72.0;
98 +               t /= mpFrameData->mnFontDPIX;
99 +               t *= 100.0;
100 +               t /= nScreenFontZoom;
101 +               aSize.Width() = (long) t;
102 +       }
103 +
104 +    double t = aSize.Height();
105 +    t -= 0.5;
106 +    t *= 72.0;
107 +    t /= mpFrameData->mnFontDPIY;
108 +    t *= 100.0;
109 +    t /= nScreenFontZoom;
110 +    aSize.Height() = (long) t;
111  
112      rFont.SetSize( aSize );
113  }
114 --- vcl/unx/source/gdi/salgdi.cxx.orig  2004-03-30 01:30:52.000000000 +0000
115 +++ vcl/unx/source/gdi/salgdi.cxx       2004-03-30 01:31:05.000000000 +0000
116 @@ -503,16 +503,6 @@
117  
118          rDPIX = pDisplay->GetResolution().A();
119          rDPIY = pDisplay->GetResolution().B();
120 -        if ( rDPIY < 96 )
121 -        {
122 -            rDPIX = Divide( rDPIX * 96, rDPIY );
123 -            rDPIY = 96;
124 -        }
125 -        else if ( rDPIY > 200 )
126 -        {
127 -            rDPIX = Divide( rDPIX * 200, rDPIY );
128 -            rDPIY = 200;
129 -        }
130   
131  #ifndef _USE_PRINT_EXTENSION_
132         }
133 Index: vcl/unx/source/app/saldisp.cxx
134 ===================================================================
135 RCS file: /cvs/gsl/vcl/unx/source/app/saldisp.cxx,v
136 retrieving revision 1.41
137 diff -u -p -u -r1.41 saldisp.cxx
138 --- vcl/unx/source/app/saldisp.cxx      28 May 2003 12:33:35 -0000      1.41
139 +++ vcl/unx/source/app/saldisp.cxx      4 Jun 2003 08:57:54 -0000
140 @@ -2948,11 +2948,13 @@ void SalDisplay::GetScreenFontResolution
141      rDPIX = aResolution_.A();
142      rDPIY = aResolution_.B();
143      
144 +#if 0    
145      if( rDPIY < nThreshold )
146      {
147          rDPIX = Divide( rDPIX * nThreshold, rDPIY );
148          rDPIY = nThreshold;
149      }
150 +#endif
151  
152      // #i12705# equalize x- and y-resolution if they are close enough
153      if( rDPIX != rDPIY )
This page took 0.036039 seconds and 3 git commands to generate.