/usr/share/ada/adainclude/gtkada/pango-font.adb is in libgtkada16.1.0-dev 17.0.2017-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet --
-- Copyright (C) 2000-2017, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the Free --
-- Software Foundation; either version 3, or (at your option) any later --
-- version. This library is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
------------------------------------------------------------------------------
pragma Style_Checks (Off);
pragma Warnings (Off, "*is already use-visible*");
with Glib.Type_Conversion_Hooks; use Glib.Type_Conversion_Hooks;
with Gtkada.Bindings; use Gtkada.Bindings;
pragma Warnings(Off); -- might be unused
with Interfaces.C.Strings; use Interfaces.C.Strings;
pragma Warnings(On);
package body Pango.Font is
subtype String7 is String (1 .. 7);
Style_Map : constant array (Enums.Style) of String7 :=
(Enums.Pango_Style_Normal => " ",
Enums.Pango_Style_Oblique => "Oblique",
Enums.Pango_Style_Italic => "Italic ");
subtype String10 is String (1 .. 10);
Variant_Map : constant array (Enums.Variant) of String10 :=
(Enums.Pango_Variant_Normal => " ",
Enums.Pango_Variant_Small_Caps => "Small-Caps");
subtype String15 is String (1 .. 15);
Stretch_Map : constant array (Enums.Stretch) of String15 :=
(Enums.Pango_Stretch_Ultra_Condensed => "Ultra-Condensed",
Enums.Pango_Stretch_Extra_Condensed => "Extra-Condensed",
Enums.Pango_Stretch_Condensed => "Condensed ",
Enums.Pango_Stretch_Semi_Condensed => "Semi-Condensed ",
Enums.Pango_Stretch_Normal => " ",
Enums.Pango_Stretch_Semi_Expanded => "Semi-Expanded ",
Enums.Pango_Stretch_Expanded => "Expanded ",
Enums.Pango_Stretch_Extra_Expanded => "Extra-Expanded ",
Enums.Pango_Stretch_Ultra_Expanded => "Ultra-Expanded ");
-- Some of the values are not directly supported by pango.
-- ??? See fonts.c in pango
Weight_Map : constant array (Enums.Weight) of String10 :=
(Enums.Pango_Weight_Ultralight => "Light ",
Enums.Pango_Weight_Thin => "Thin ",
Enums.Pango_Weight_Light => "Light ",
Enums.Pango_Weight_Normal => " ",
Enums.Pango_Weight_Book => "Book ",
Enums.Pango_Weight_Medium => "Medium ",
Enums.Pango_Weight_Semibold => "Semi-Bold ",
Enums.Pango_Weight_Bold => "Bold ",
Enums.Pango_Weight_Semilight => "Semi-Light",
Enums.Pango_Weight_Ultrabold => "Bold ",
Enums.Pango_Weight_Ultraheavy => "Ultraheavy",
Enums.Pango_Weight_Heavy => "Heavy ");
function To_Font_Description
(Family_Name : String := "";
Style : Enums.Style := Enums.Pango_Style_Normal;
Variant : Enums.Variant := Enums.Pango_Variant_Normal;
Weight : Enums.Weight := Enums.Pango_Weight_Normal;
Stretch : Enums.Stretch := Enums.Pango_Stretch_Normal;
Size : Gint := 0) return Pango_Font_Description
is
begin
return From_String (Family_Name & " " &
Style_Map (Style) & " " &
Variant_Map (Variant) &
Weight_Map (Weight) & " " &
Stretch_Map (Stretch) & Gint'Image (Size));
end To_Font_Description;
function To_Address
(F : Pango_Font_Description; Add : System.Address)
return System.Address
is
pragma Unreferenced (Add);
begin
return F.all'Address;
end To_Address;
----------
-- Free --
----------
procedure Free (Desc : in out Pango_Font_Description) is
procedure Internal (Desc : Pango_Font_Description);
pragma Import (C, Internal, "pango_font_description_free");
begin
Internal (Desc);
Desc := null;
end Free;
package Type_Conversion_Pango_Font is new Glib.Type_Conversion_Hooks.Hook_Registrator
(Font_Get_Type'Access, Pango_Font_Record);
pragma Unreferenced (Type_Conversion_Pango_Font);
-------------
-- Gdk_New --
-------------
procedure Gdk_New (Self : out Pango_Font_Description) is
function Internal return Pango_Font_Description;
pragma Import (C, Internal, "pango_font_description_new");
begin
Self := Internal;
end Gdk_New;
--------------------------------
-- Pango_Font_Description_New --
--------------------------------
function Pango_Font_Description_New return Pango_Font_Description is
function Internal return Pango_Font_Description;
pragma Import (C, Internal, "pango_font_description_new");
Self : Pango_Font_Description;
begin
Self := Internal;
return Self;
end Pango_Font_Description_New;
------------------
-- Better_Match --
------------------
function Better_Match
(Self : Pango_Font_Description;
Old_Match : Pango_Font_Description;
New_Match : Pango_Font_Description) return Boolean
is
function Internal
(Self : Pango_Font_Description;
Old_Match : Pango_Font_Description;
New_Match : Pango_Font_Description) return Glib.Gboolean;
pragma Import (C, Internal, "pango_font_description_better_match");
begin
return Internal (Self, Old_Match, New_Match) /= 0;
end Better_Match;
--------------
-- Describe --
--------------
function Describe
(Font : not null access Pango_Font_Record'Class)
return Pango_Font_Description
is
function Internal
(Font : System.Address) return Pango_Font_Description;
pragma Import (C, Internal, "pango_font_describe");
begin
return Internal (Get_Object (Font));
end Describe;
---------------------------------
-- Describe_With_Absolute_Size --
---------------------------------
function Describe_With_Absolute_Size
(Font : not null access Pango_Font_Record'Class)
return Pango_Font_Description
is
function Internal
(Font : System.Address) return Pango_Font_Description;
pragma Import (C, Internal, "pango_font_describe_with_absolute_size");
begin
return Internal (Get_Object (Font));
end Describe_With_Absolute_Size;
-----------
-- Equal --
-----------
function Equal
(Self : Pango_Font_Description;
Desc2 : Pango_Font_Description) return Boolean
is
function Internal
(Self : Pango_Font_Description;
Desc2 : Pango_Font_Description) return Glib.Gboolean;
pragma Import (C, Internal, "pango_font_description_equal");
begin
return Internal (Self, Desc2) /= 0;
end Equal;
----------------
-- Get_Family --
----------------
function Get_Family (Self : Pango_Font_Description) return UTF8_String is
function Internal
(Self : Pango_Font_Description)
return Interfaces.C.Strings.chars_ptr;
pragma Import (C, Internal, "pango_font_description_get_family");
begin
return Gtkada.Bindings.Value_Allowing_Null (Internal (Self));
end Get_Family;
-----------------------
-- Get_Glyph_Extents --
-----------------------
procedure Get_Glyph_Extents
(Font : not null access Pango_Font_Record;
Glyph : Pango_Glyph;
Ink_Rect : out Pango_Rectangle;
Logical_Rect : out Pango_Rectangle)
is
procedure Internal
(Font : System.Address;
Glyph : Pango_Glyph;
Ink_Rect : out Pango_Rectangle;
Logical_Rect : out Pango_Rectangle);
pragma Import (C, Internal, "pango_font_get_glyph_extents");
begin
Internal (Get_Object (Font), Glyph, Ink_Rect, Logical_Rect);
end Get_Glyph_Extents;
-----------------
-- Get_Metrics --
-----------------
function Get_Metrics
(Font : not null access Pango_Font_Record;
Language : Pango.Language.Pango_Language := Pango.Language.Null_Pango_Language)
return Pango.Font_Metrics.Pango_Font_Metrics
is
function Internal
(Font : System.Address;
Language : System.Address) return System.Address;
pragma Import (C, Internal, "pango_font_get_metrics");
begin
return From_Object (Internal (Get_Object (Font), Get_Object (Language)));
end Get_Metrics;
--------------------------
-- Get_Size_Is_Absolute --
--------------------------
function Get_Size_Is_Absolute
(Self : Pango_Font_Description) return Boolean
is
function Internal (Self : Pango_Font_Description) return Glib.Gboolean;
pragma Import (C, Internal, "pango_font_description_get_size_is_absolute");
begin
return Internal (Self) /= 0;
end Get_Size_Is_Absolute;
-----------
-- Merge --
-----------
procedure Merge
(Self : Pango_Font_Description;
Desc_To_Merge : Pango_Font_Description;
Replace_Existing : Boolean)
is
procedure Internal
(Self : Pango_Font_Description;
Desc_To_Merge : Pango_Font_Description;
Replace_Existing : Glib.Gboolean);
pragma Import (C, Internal, "pango_font_description_merge");
begin
Internal (Self, Desc_To_Merge, Boolean'Pos (Replace_Existing));
end Merge;
------------------
-- Merge_Static --
------------------
procedure Merge_Static
(Self : Pango_Font_Description;
Desc_To_Merge : Pango_Font_Description;
Replace_Existing : Boolean)
is
procedure Internal
(Self : Pango_Font_Description;
Desc_To_Merge : Pango_Font_Description;
Replace_Existing : Glib.Gboolean);
pragma Import (C, Internal, "pango_font_description_merge_static");
begin
Internal (Self, Desc_To_Merge, Boolean'Pos (Replace_Existing));
end Merge_Static;
----------------
-- Set_Family --
----------------
procedure Set_Family
(Self : Pango_Font_Description;
Family : UTF8_String)
is
procedure Internal
(Self : Pango_Font_Description;
Family : Interfaces.C.Strings.chars_ptr);
pragma Import (C, Internal, "pango_font_description_set_family");
Tmp_Family : Interfaces.C.Strings.chars_ptr := New_String (Family);
begin
Internal (Self, Tmp_Family);
Free (Tmp_Family);
end Set_Family;
-----------------------
-- Set_Family_Static --
-----------------------
procedure Set_Family_Static
(Self : Pango_Font_Description;
Family : UTF8_String)
is
procedure Internal
(Self : Pango_Font_Description;
Family : Interfaces.C.Strings.chars_ptr);
pragma Import (C, Internal, "pango_font_description_set_family_static");
Tmp_Family : Interfaces.C.Strings.chars_ptr := New_String (Family);
begin
Internal (Self, Tmp_Family);
Free (Tmp_Family);
end Set_Family_Static;
-----------------
-- To_Filename --
-----------------
function To_Filename (Self : Pango_Font_Description) return UTF8_String is
function Internal
(Self : Pango_Font_Description)
return Interfaces.C.Strings.chars_ptr;
pragma Import (C, Internal, "pango_font_description_to_filename");
begin
return Gtkada.Bindings.Value_And_Free (Internal (Self));
end To_Filename;
---------------
-- To_String --
---------------
function To_String (Self : Pango_Font_Description) return UTF8_String is
function Internal
(Self : Pango_Font_Description)
return Interfaces.C.Strings.chars_ptr;
pragma Import (C, Internal, "pango_font_description_to_string");
begin
return Gtkada.Bindings.Value_And_Free (Internal (Self));
end To_String;
-----------------
-- From_String --
-----------------
function From_String (Str : UTF8_String) return Pango_Font_Description is
function Internal
(Str : Interfaces.C.Strings.chars_ptr)
return Pango_Font_Description;
pragma Import (C, Internal, "pango_font_description_from_string");
Tmp_Str : Interfaces.C.Strings.chars_ptr := New_String (Str);
Tmp_Return : Pango_Font_Description;
begin
Tmp_Return := Internal (Tmp_Str);
Free (Tmp_Str);
return Tmp_Return;
end From_String;
end Pango.Font;
|