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