1. ----------------------------------------------------------------------- 
  2. --               GtkAda - Ada95 binding for Gtk+/Gnome               -- 
  3. --                                                                   -- 
  4. --                    Copyright (C) 2010-2013, AdaCore               -- 
  5. --                                                                   -- 
  6. -- This library is free software; you can redistribute it and/or     -- 
  7. -- modify it under the terms of the GNU General Public               -- 
  8. -- License as published by the Free Software Foundation; either      -- 
  9. -- version 2 of the License, or (at your option) any later version.  -- 
  10. --                                                                   -- 
  11. -- This library is distributed in the hope that it will be useful,   -- 
  12. -- but WITHOUT ANY WARRANTY; without even the implied warranty of    -- 
  13. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -- 
  14. -- General Public License for more details.                          -- 
  15. --                                                                   -- 
  16. -- You should have received a copy of the GNU General Public         -- 
  17. -- License along with this library; if not, write to the             -- 
  18. -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      -- 
  19. -- Boston, MA 02111-1307, USA.                                       -- 
  20. --                                                                   -- 
  21. -- As a special exception, if other files instantiate generics from  -- 
  22. -- this unit, or you link this unit with other files to produce an   -- 
  23. -- executable, this  unit  does not  by itself cause  the resulting  -- 
  24. -- executable to be covered by the GNU General Public License. This  -- 
  25. -- exception does not however invalidate any other reasons why the   -- 
  26. -- executable file  might be covered by the  GNU Public License.     -- 
  27. ----------------------------------------------------------------------- 
  28.  
  29. --  <description> 
  30. --  Utilities for manipulating font faces. 
  31. --  </description> 
  32. -- 
  33. --  <c_version>1.8.8</c_version> 
  34. --  <group>Cairo</group> 
  35.  
  36. with Interfaces.C.Strings; 
  37.  
  38. package Cairo.Scaled_Font is 
  39.  
  40.    function Reference 
  41.      (Scaled_Font : Cairo_Scaled_Font) 
  42.       return        Cairo_Scaled_Font; 
  43.    --  Scaled_Font: a Cairo.Scaled_Font.T, (may be null in which case 
  44.    --  this function does nothing) 
  45.    -- 
  46.    --  Increases the reference count on scaled_font by one. This prevents 
  47.    --  scaled_font from being destroyed until a matching call to 
  48.    --  Cairo.Scaled_Font.Destroy is made. 
  49.    -- 
  50.    --  The number of references to a Cairo_Scaled_Font can be get using 
  51.    --  Cairo.Scaled_Font.Get_Reference_Count. 
  52.    -- 
  53.    --  Returns: the referenced Cairo_Scaled_Font 
  54.  
  55.    procedure Destroy (Scaled_Font : Cairo_Scaled_Font); 
  56.    --  Scaled_Font: a Cairo_Scaled_Font 
  57.    -- 
  58.    --  Decreases the reference count on font by one. If the result 
  59.    --  is zero, then font and all associated resources are freed. 
  60.    --  See Cairo.Scaled_Font.Reference. 
  61.  
  62.    function Get_Reference_Count 
  63.      (Scaled_Font : Cairo_Scaled_Font) 
  64.       return        Guint; 
  65.    --  Scaled_Font: a Cairo_Scaled_Font 
  66.    -- 
  67.    --  Returns the current reference count of scaled_font. 
  68.    -- 
  69.    --  Return value: the current reference count of scaled_font.  If the 
  70.    --  object is a nil object, 0 will be returned. 
  71.    -- 
  72.    --  Since: 1.4 
  73.  
  74.    function Status (Scaled_Font : Cairo_Scaled_Font) return Cairo_Status; 
  75.    --  Scaled_Font: a Cairo_Scaled_Font 
  76.    -- 
  77.    --  Checks whether an error has previously occurred for this 
  78.    --  scaled_font. 
  79.    -- 
  80.    --  Return value: Cairo_Status_Success or another error such as 
  81.    --    Cairo_Status_No_Memory. 
  82.  
  83.    function Get_Type 
  84.      (Scaled_Font : Cairo_Scaled_Font) 
  85.       return        Cairo_Font_Type; 
  86.    --  Scaled_Font: a Cairo_Scaled_Font 
  87.    -- 
  88.    --  This function returns the type of the backend used to create 
  89.    --  a scaled font. See Cairo_Font_Type for available types. 
  90.    -- 
  91.    --  Return value: The type of scaled_font. 
  92.    -- 
  93.    --  Since: 1.2 
  94.  
  95.    procedure Extents 
  96.      (Scaled_Font : Cairo_Scaled_Font; 
  97.       Extents     : access Cairo_Font_Extents); 
  98.    --  Scaled_Font: a Cairo_Scaled_Font 
  99.    --  Extents: a Cairo_Font_Extents which to store the retrieved Extents. 
  100.    -- 
  101.    --  Gets the metrics for a Cairo_Scaled_Font. 
  102.  
  103.    procedure Text_Extents 
  104.      (Scaled_Font : Cairo_Scaled_Font; 
  105.       Utf8        : Interfaces.C.Strings.chars_ptr; 
  106.       Extents     : Cairo_Text_Extents); 
  107.    --  Scaled_Font: a Cairo_Scaled_Font 
  108.    --  Utf8: a NUL-terminated string of text, encoded in UTF-8 
  109.    --  Extents: a Cairo_Text_Extents which to store the retrieved Extents. 
  110.    -- 
  111.    --  Gets the extents for a string of text. The extents describe a 
  112.    --  user-space rectangle that encloses the "inked" portion of the text 
  113.    --  drawn at the origin (0,0) (as it would be drawn by Cairo_Show_Text 
  114.    --  if the cairo graphics state were set to the same font_face, 
  115.    --  font_matrix, ctm, and font_options as scaled_font).  Additionally, 
  116.    --  the x_advance and y_advance values indicate the amount by which the 
  117.    --  current point would be advanced by Cairo_Show_Text. 
  118.    -- 
  119.    --  Note that whitespace characters do not directly contribute to the 
  120.    --  size of the rectangle (extents.width and extents.height). They do 
  121.    --  contribute indirectly by changing the position of non-whitespace 
  122.    --  characters. In particular, trailing whitespace characters are 
  123.    --  likely to not affect the size of the rectangle, though they will 
  124.    --  affect the x_advance and y_advance values. 
  125.    -- 
  126.    --  Since: 1.2 
  127.  
  128.    procedure Glyph_Extents 
  129.      (Scaled_Font : Cairo_Scaled_Font; 
  130.       Glyphs      : access Cairo_Glyph; 
  131.       Num_Glyphs  : Gint; 
  132.       Extents     : Cairo_Text_Extents); 
  133.    --  Scaled_Font: a Cairo_Scaled_Font 
  134.    --  Glyphs: an array of glyph IDs with X and Y offsets. 
  135.    --  Num_Glyphs: the number of glyphs in the glyphs array 
  136.    --  Extents: a Cairo_Text_Extents which to store the retrieved Extents. 
  137.    -- 
  138.    --  Gets the extents for an array of glyphs. The extents describe a 
  139.    --  user-space rectangle that encloses the "inked" portion of the 
  140.    --  glyphs, (as they would be drawn by Cairo.Show_Glyphs if the cairo 
  141.    --  graphics state were set to the same Font_Face, Font_Matrix, Ctm, 
  142.    --  and Font_Options as Scaled_Font).  Additionally, the x_advance and 
  143.    --  Y_Advance values indicate the amount by which the current point 
  144.    --  would be advanced by Cairo.Show_Glyphs. 
  145.    -- 
  146.    --  Note that whitespace glyphs do not contribute to the size of the 
  147.    --  rectangle (extents.width and extents.height). 
  148.  
  149.    function Get_Font_Face 
  150.      (Scaled_Font : Cairo_Scaled_Font) 
  151.       return        Cairo_Font_Face; 
  152.    --  Scaled_Font: a Cairo_Scaled_Font 
  153.    -- 
  154.    --  Gets the font face that this scaled font was created for. 
  155.    -- 
  156.    --  Return value: The Cairo_Font_Face with which Scaled_Font was 
  157.    --  created. 
  158.    -- 
  159.    --  Since: 1.2 
  160.  
  161.    procedure Get_Font_Matrix 
  162.      (Scaled_Font : Cairo_Scaled_Font; 
  163.       Font_Matrix : access Cairo_Matrix); 
  164.    --  Scaled_Font: a Cairo_Scaled_Font 
  165.    --  Font_Matrix: return value for the matrix 
  166.    -- 
  167.    --  Stores the font matrix with which Scaled_Font was created into 
  168.    --  matrix. 
  169.    -- 
  170.    --  Since: 1.2 
  171.  
  172.    procedure Get_Ctm 
  173.      (Scaled_Font : Cairo_Scaled_Font; 
  174.       Ctm         : access Cairo_Matrix); 
  175.    --  Scaled_Font: a Cairo_Scaled_Font 
  176.    --  Ctm: return value for the CTM 
  177.    -- 
  178.    --  Stores the CTM with which Scaled_Font was created into Ctm. 
  179.    -- 
  180.    --  Since: 1.2 
  181.  
  182.    procedure Get_Scale_Matrix 
  183.      (Scaled_Font  : Cairo_Scaled_Font; 
  184.       Scale_Matrix : access Cairo_Matrix); 
  185.    --  Scaled_Font: a Cairo_Scaled_Font 
  186.    --  Scale_Matrix: return value for the matrix 
  187.    -- 
  188.    --  Stores the scale matrix of scaled_font into matrix. 
  189.    --  The scale matrix is product of the font matrix and the ctm 
  190.    --  associated with the scaled font, and hence is the matrix mapping from 
  191.    --  font space to device space. 
  192.    -- 
  193.    --  Since: 1.8 
  194.  
  195.    procedure Get_Font_Options 
  196.      (Scaled_Font : Cairo_Scaled_Font; 
  197.       Options     : Cairo_Font_Options); 
  198.    --  Scaled_Font: a Cairo_Scaled_Font 
  199.    --  Options: return value for the font Options 
  200.    -- 
  201.    --  Stores the font options with which scaled_font was created into 
  202.    --  options. 
  203.    -- 
  204.    --  Since: 1.2 
  205.  
  206. private 
  207.  
  208.    pragma Import (C, Reference, "cairo_scaled_font_reference"); 
  209.    pragma Import (C, Destroy, "cairo_scaled_font_destroy"); 
  210.    pragma Import 
  211.      (C, 
  212.       Get_Reference_Count, 
  213.       "cairo_scaled_font_get_reference_count"); 
  214.    pragma Import (C, Status, "cairo_scaled_font_status"); 
  215.    pragma Import (C, Get_Type, "cairo_scaled_font_get_type"); 
  216.    pragma Import (C, Extents, "cairo_scaled_font_extents"); 
  217.    pragma Import (C, Text_Extents, "cairo_scaled_font_text_extents"); 
  218.    pragma Import (C, Glyph_Extents, "cairo_scaled_font_glyph_extents"); 
  219.    pragma Import (C, Get_Font_Face, "cairo_scaled_font_get_font_face"); 
  220.    pragma Import (C, Get_Font_Matrix, "cairo_scaled_font_get_font_matrix"); 
  221.    pragma Import (C, Get_Ctm, "cairo_scaled_font_get_ctm"); 
  222.    pragma Import (C, Get_Scale_Matrix, "cairo_scaled_font_get_scale_matrix"); 
  223.    pragma Import (C, Get_Font_Options, "cairo_scaled_font_get_font_options"); 
  224.  
  225.    --  Not bound : 
  226. --     pragma Import (C, Text_To_Glyphs, "cairo_scaled_font_text_to_glyphs"); 
  227. --     pragma Import (C, Create, "cairo_scaled_font_create"); 
  228. --     pragma Import (C, Get_User_Data, "cairo_scaled_font_get_user_data"); 
  229. --     pragma Import (C, Set_User_Data, "cairo_scaled_font_set_user_data"); 
  230. end Cairo.Scaled_Font;