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