From: Axel S. <as...@us...> - 2005-07-30 17:32:15
|
Update of /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Pango In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6839/gtk/Graphics/UI/Gtk/Pango Modified Files: Description.chs Layout.chs Rendering.chs.pp Types.chs.pp Log Message: Added two functions, but mostly docu fixes. Index: Rendering.chs.pp =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Pango/Rendering.chs.pp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Rendering.chs.pp 8 May 2005 12:58:41 -0000 1.3 +++ Rendering.chs.pp 30 Jul 2005 17:32:05 -0000 1.4 @@ -39,6 +39,8 @@ FontMetrics(..), contextSetFontDescription, contextGetFontDescription, + Language, + languageFromString, contextSetLanguage, contextGetLanguage, contextSetTextDir, @@ -107,10 +109,10 @@ {#call unsafe font_metrics_get_approximate_digit_width#} mPtr {#call unsafe font_metrics_unref#} mPtr return (FontMetrics - (ascend % pangoScale) - (descend % pangoScale) - (cWidth % pangoScale) - (dWidth % pangoScale)) + (ascend % fromIntegral pangoScale) + (descend % fromIntegral pangoScale) + (cWidth % fromIntegral pangoScale) + (dWidth % fromIntegral pangoScale)) -- | The characteristic measurements of a font. -- @@ -132,7 +134,7 @@ -- initial size for a window. Actual characters in text will be -- wider and narrower than this. approximateCharWidth :: Rational, - -- | The approximate digit widt. This is merely a representative + -- | The approximate digit width. This is merely a representative -- value useful, for example, for determining the initial size for -- a window. Actual digits in text can be wider and narrower than -- this, though this value is generally somewhat more accurate Index: Layout.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Pango/Layout.chs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Layout.chs 12 Feb 2005 17:19:24 -0000 1.2 +++ Layout.chs 30 Jul 2005 17:32:05 -0000 1.3 @@ -50,6 +50,7 @@ -- module Graphics.UI.Gtk.Pango.Layout ( PangoLayout, + layoutEmpty, layoutCopy, layoutGetContext, layoutContextChanged, @@ -106,11 +107,17 @@ {#import Graphics.UI.Gtk.Types#} import Graphics.UI.Gtk.Pango.Markup (Markup) import Graphics.UI.Gtk.General.Enums -import Graphics.UI.Gtk.General.Structs (Rectangle) +import Graphics.UI.Gtk.General.Structs (Rectangle, pangoScale) {#import Graphics.UI.Gtk.Pango.Types#} {# context lib="pango" prefix="pango" #} +-- | Create an empty 'Layout'. +-- +layoutEmpty :: PangoContext -> IO PangoLayout +layoutEmpty pc = makeNewGObject mkPangoLayout + ({#call unsafe layout_new#} (toPangoContext pc)) + -- | Create a copy of the 'Layout'. -- layoutCopy :: PangoLayout -> IO PangoLayout @@ -240,11 +247,12 @@ -- | Set the indentation of this paragraph. -- --- * Sets the amount by which the first line should be shorter than --- the rest of the lines. This may be negative, in which case the --- subsequent lines will be shorter than the first line. (However, in --- either case, the entire width of the layout will be given by the --- value. +-- * Sets the amount by which the first line should +-- be indented. A negative value will produce a hanging indent, that is, +-- all subsequent lines will be indented while the first line has full +-- width. +-- +-- * The value is given in 1\/'pangoScale' device units. -- layoutSetIndent :: PangoLayout -> Int -> IO () layoutSetIndent pl indent = @@ -252,8 +260,10 @@ -- | Gets the indentation of this paragraph. -- --- * Gets the amount by which the first line should be shorter than --- the rest of the lines. +-- * Gets the amount by which the first line or the rest of the paragraph +-- is indented. +-- +-- * The value is given in 1\/'pangoScale' device units. -- layoutGetIndent :: PangoLayout -> IO Int layoutGetIndent pl = liftM fromIntegral $ {#call unsafe layout_get_indent#} pl @@ -261,12 +271,16 @@ -- | Set the spacing between lines of this paragraph. -- +-- * The value is given in 1\/'pangoScale' device units. +-- layoutSetSpacing :: PangoLayout -> Int -> IO () layoutSetSpacing pl spacing = {#call unsafe layout_set_spacing#} pl (fromIntegral spacing) -- | Gets the spacing between the lines. -- +-- * The value is given in 1\/'pangoScale' device units. +-- layoutGetSpacing :: PangoLayout -> IO Int layoutGetSpacing pl = liftM fromIntegral $ {#call unsafe layout_get_spacing#} pl @@ -339,8 +353,7 @@ -- bounding box that includes all character pixels. The ink size can be -- smaller or larger that the logical layout. -- --- * All values are in layout units. To get to device units (pixel for --- 'Drawable's) divide by 'pangoScale'. +-- * The value is given in 1\/'pangoScale' device units. -- layoutGetExtents :: PangoLayout -> IO (Rectangle, Rectangle) layoutGetExtents pl = alloca $ \logPtr -> alloca $ \inkPtr -> do @@ -357,8 +370,7 @@ -- bounding box that includes all character pixels. The ink size can be -- smaller or larger that the logical layout. -- --- * All values are in device units. This function is a wrapper around --- 'layoutGetExtents' with scaling. +-- * The value is given in 1\/'pangoScale' device units. -- layoutGetPixelExtents :: PangoLayout -> IO (Rectangle, Rectangle) layoutGetPixelExtents pl = alloca $ \logPtr -> alloca $ \inkPtr -> do @@ -466,8 +478,7 @@ -- * Computes the logical and the ink size of the cluster pointed to by -- 'LayoutIter'. -- --- * All values are in layoutIter units. To get to device units (pixel for --- 'Drawable's) divide by 'pangoScale'. +-- * The value is given in 1\/'pangoScale' device units. -- layoutIterGetClusterExtents :: LayoutIter -> IO (Rectangle, Rectangle) layoutIterGetClusterExtents li = alloca $ \logPtr -> alloca $ \inkPtr -> do @@ -482,8 +493,7 @@ -- * Computes the logical and the ink size of the run pointed to by -- 'LayoutIter'. -- --- * All values are in layoutIter units. To get to device units (pixel for --- 'Drawable's) divide by 'pangoScale'. +-- * The value is given in 1\/'pangoScale' device units. -- layoutIterGetRunExtents :: LayoutIter -> IO (Rectangle, Rectangle) layoutIterGetRunExtents li = alloca $ \logPtr -> alloca $ \inkPtr -> do @@ -541,8 +551,7 @@ -- bounding box that includes all character pixels. The ink size can be -- smaller or larger that the logical layout. -- --- * All values are in layout units. To get to device units (pixel for --- 'Drawable's) divide by 'pangoScale'. +-- * The value is given in 1\/'pangoScale' device units. -- layoutLineGetExtents :: LayoutLine -> IO (Rectangle, Rectangle) layoutLineGetExtents pl = alloca $ \logPtr -> alloca $ \inkPtr -> do @@ -558,8 +567,7 @@ -- bounding box that includes all character pixels. The ink size can be -- smaller or larger that the logical layout. -- --- * All values are in device units. This function is a wrapper around --- 'layoutLineGetExtents' with scaling. +-- * The value is given in 1\/'pangoScale' device units. -- layoutLineGetPixelExtents :: LayoutLine -> IO (Rectangle, Rectangle) layoutLineGetPixelExtents pl = alloca $ \logPtr -> alloca $ \inkPtr -> do Index: Description.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Pango/Description.chs,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Description.chs 8 May 2005 12:59:27 -0000 1.5 +++ Description.chs 30 Jul 2005 17:32:05 -0000 1.6 @@ -51,7 +51,8 @@ fontDescriptionMerge, fontDescriptionBetterMatch, fontDescriptionFromString, - fontDescriptionToString + fontDescriptionToString, + pangoScale -- FIXME: move to GlyphStorage once that file exists ) where import Monad (liftM) @@ -184,7 +185,7 @@ fontDescriptionGetSize fd = do fields <- {#call unsafe get_set_fields#} fd if (fromEnum PangoFontMaskSize) .&. (fromIntegral fields) /=0 - then liftM (\x -> Just (fromIntegral x % pangoScale)) $ + then liftM (\x -> Just (fromIntegral x % fromIntegral pangoScale)) $ {#call unsafe get_size#} fd else return Nothing Index: Types.chs.pp =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Pango/Types.chs.pp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Types.chs.pp 8 May 2005 12:58:41 -0000 1.4 +++ Types.chs.pp 30 Jul 2005 17:32:05 -0000 1.5 @@ -19,6 +19,8 @@ -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- +-- #hide + -- | -- Maintainer : gtk...@li... -- Stability : provisional |