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. --  A set of utilities to handle the Cairo_Font_Face type, and the Cairo 
  31. --  'toy' text API. 
  32. --  </description> 
  33. -- 
  34. --  <c_version>1.8.8</c_version> 
  35. --  <group>Cairo</group> 
  36.  
  37. with System; 
  38. with Interfaces.C.Strings; 
  39.  
  40. package Cairo.Font_Face is 
  41.  
  42.    function Reference (Font_Face : Cairo_Font_Face) return Cairo_Font_Face; 
  43.    --  Font_Face: a Cairo_Font_Face, (may be Null_Font_Face in which case this 
  44.    --  function does nothing). 
  45.    -- 
  46.    --  Increases the reference count on Font_Face by one. This prevents 
  47.    --  Font_Face from being destroyed until a matching call to 
  48.    --  Cairo.Font_Face.Destroy is made. 
  49.    -- 
  50.    --  The number of references to a Cairo_Font_Face can be get using 
  51.    --  Cairo.Font_Face.Get_Reference_Count. 
  52.    -- 
  53.    --  Return value: the referenced Cairo_Font_Face. 
  54.  
  55.    procedure Destroy (Font_Face : Cairo_Font_Face); 
  56.    --  Font_Face: a Cairo_Font_Face 
  57.    -- 
  58.    --  Decreases the reference count on Font_Face by one. If the result 
  59.    --  is zero, then Font_Face and all associated resources are freed. 
  60.    --  See Cairo.Font_Face.Reference. 
  61.  
  62.    function Get_Reference_Count (Font_Face : Cairo_Font_Face) return Guint; 
  63.    --  Font_Face: a Cairo_Font_Face 
  64.    -- 
  65.    --  Returns the current reference count of Font_Face. 
  66.    -- 
  67.    --  Return value: the current reference count of Font_Face.  If the 
  68.    --  object is a nil object, 0 will be returned. 
  69.    -- 
  70.    --  Since: 1.4 
  71.  
  72.    function Status (Font_Face : Cairo_Font_Face) return Cairo_Status; 
  73.    --  Font_Face: a Cairo_Font_Face 
  74.    -- 
  75.    --  Checks whether an error has previously occurred for this 
  76.    --  font face 
  77.    -- 
  78.    --  Return value: Cairo_Status_Success or another error such as 
  79.    --    Cairo_Status_No_Memory. 
  80.  
  81.    function Get_Type (Font_Face : Cairo_Font_Face) return Cairo_Font_Type; 
  82.    --  Font_Face: a font face 
  83.    -- 
  84.    --  This function returns the type of the backend used to create 
  85.    --  a font face. See Cairo_Font_Type for available types. 
  86.    -- 
  87.    --  Return value: The type of Font_Face. 
  88.    -- 
  89.    --  Since: 1.2 
  90.  
  91.    function Get_User_Data 
  92.      (Font_Face : Cairo_Font_Face; 
  93.       Key       : access Cairo_User_Data_Key) return System.Address; 
  94.    --  Font_Face: a Cairo_Font_Face 
  95.    --  Key: the address of the Cairo_User_Data_Key the user data was 
  96.    --  attached to 
  97.    -- 
  98.    --  Return user data previously attached to Font_Face using the specified 
  99.    --  key.  If no user data has been attached with the given key this 
  100.    --  function returns System.Null_Address. 
  101.    -- 
  102.    --  Return value: the user data previously attached or System.Null_Address. 
  103.  
  104.    function Set_User_Data 
  105.      (Font_Face : Cairo_Font_Face; 
  106.       Key       : access Cairo_User_Data_Key; 
  107.       User_Data : System.Address; 
  108.       Destroy   : Cairo_Destroy_Func) return Cairo_Status; 
  109.    --  Font_Face: a Cairo_Font_Face 
  110.    --  Key: the address of a Cairo_User_Data_Key to attach the user data to 
  111.    --  User_Data: the user data to attach to the font face 
  112.    --  Destroy: a Cairo_Destroy_Func which will be called when the 
  113.    --  font face is destroyed or when new user data is attached using the 
  114.    --  same key. 
  115.    -- 
  116.    --  Attach user data to Font_Face.  To remove user data from a font face, 
  117.    --  call this function with the key that was used to set it and 
  118.    --  System.Null_Address for data. 
  119.    -- 
  120.    --  Return value: Cairo_Status_Success or Cairo_Status_No_Memory if a 
  121.    --  slot could not be allocated for the user data. 
  122.  
  123.    function Toy_Font_Face_Create 
  124.      (Family : Interfaces.C.Strings.chars_ptr; 
  125.       Slant  : Cairo_Font_Slant; 
  126.       Weight : Cairo_Font_Weight) 
  127.       return   Cairo_Font_Face; 
  128.    --  Family: a font Family name, encoded in UTF-8 
  129.    --  Slant: the Slant for the font 
  130.    --  Weight: the Weight for the font 
  131.    -- 
  132.    --  Creates a font face from a triplet of family, slant, and weight. 
  133.    --  These font faces are used in implementation of the the Cairo_Context 
  134.    --  "toy" font API. 
  135.    -- 
  136.    --  If Family is the zero-length string "", the platform-specific default 
  137.    --  family is assumed.  The default family then can be queried using 
  138.    --  Toy_Font_Face_Get_Family. 
  139.    -- 
  140.    --  The Cairo_Select_Font_Face function uses this to create font faces. 
  141.    --  See that function for limitations of toy font faces. 
  142.    -- 
  143.    --  Return value: a newly created Cairo_Font_Face. Free with 
  144.    --    Cairo.Font_Face.Destroy when you are done using it. 
  145.    -- 
  146.    --  Since: 1.8 
  147.  
  148.    function Toy_Font_Face_Get_Family 
  149.      (Font_Face : Cairo_Font_Face) 
  150.       return      Interfaces.C.Strings.chars_ptr; 
  151.    --  Font_Face: A toy font face 
  152.    -- 
  153.    --  Gets the familly name of a toy font. 
  154.    -- 
  155.    --  Return value: The family name.  This string is owned by the font face 
  156.    --  and remains valid as long as the font face is alive (referenced). 
  157.    -- 
  158.    --  Since: 1.8 
  159.  
  160.    function Toy_Font_Face_Get_Slant 
  161.      (Font_Face : Cairo_Font_Face) 
  162.       return      Cairo_Font_Slant; 
  163.    --  Font_Face: A toy font face 
  164.    -- 
  165.    --  Gets the slant a toy font. 
  166.    -- 
  167.    --  Return value: The slant value 
  168.    -- 
  169.    --  Since: 1.8 
  170.  
  171.    function Toy_Font_Face_Get_Weight 
  172.      (Font_Face : Cairo_Font_Face) 
  173.       return      Cairo_Font_Weight; 
  174.    --  Font_Face: A toy font face 
  175.    -- 
  176.    --  Gets the weight a toy font. 
  177.    -- 
  178.    --  Return value: The weight value 
  179.    -- 
  180.    --  Since: 1.8 
  181.  
  182. private 
  183.  
  184.    pragma Import (C, Reference, "cairo_font_face_reference"); 
  185.    pragma Import (C, Destroy, "cairo_font_face_destroy"); 
  186.    pragma Import 
  187.      (C, 
  188.       Get_Reference_Count, 
  189.       "cairo_font_face_get_reference_count"); 
  190.    pragma Import (C, Status, "cairo_font_face_status"); 
  191.    pragma Import (C, Get_Type, "cairo_font_face_get_type"); 
  192.    pragma Import (C, Get_User_Data, "cairo_font_face_get_user_data"); 
  193.    pragma Import (C, Set_User_Data, "cairo_font_face_set_user_data"); 
  194.    pragma Import 
  195.      (C, 
  196.       Toy_Font_Face_Create, 
  197.       "cairo_toy_font_face_create"); 
  198.    pragma Import 
  199.      (C, 
  200.       Toy_Font_Face_Get_Family, 
  201.       "cairo_toy_font_face_get_family"); 
  202.    pragma Import 
  203.      (C, 
  204.       Toy_Font_Face_Get_Slant, 
  205.       "cairo_toy_font_face_get_slant"); 
  206.    pragma Import 
  207.      (C, 
  208.       Toy_Font_Face_Get_Weight, 
  209.       "cairo_toy_font_face_get_weight"); 
  210.  
  211. end Cairo.Font_Face;