summary refs log tree commit diff stats
path: root/lib/wrappers/gtk/pango.nim
blob: 5d9fcd96f93b05b32e2ccf7a881cf57b402a7a1c (plain) (blame)
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
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
{.deadCodeElim: on.}
import 
  glib2

when defined(win32): 
  const 
    lib* = "libpango-1.0-0.dll"
elif defined(macosx): 
  const 
    lib* = "libpango-1.0.dylib"
else: 
  const 
    lib* = "libpango-1.0.so.0"
type 
  TFont* {.pure, final.} = object
  PFont* = ptr TFont
  TFontFamily* {.pure, final.} = object
  PFontFamily* = ptr TFontFamily
  TFontSet* {.pure, final.} = object
  PFontset* = ptr TFontset
  TFontMetrics* {.pure, final.} = object
  PFontMetrics* = ptr TFontMetrics
  TFontFace* {.pure, final.} = object
  PFontFace* = ptr TFontFace
  TFontMap* {.pure, final.} = object
  PFontMap* = ptr TFontMap
  TFontsetClass {.pure, final.} = object
  PFontsetClass* = ptr TFontSetClass
  TFontFamilyClass* {.pure, final.} = object
  PFontFamilyClass* = ptr TFontFamilyClass
  TFontFaceClass* {.pure, final.} = object
  PFontFaceClass* = ptr TFontFaceClass
  TFontClass* {.pure, final.} = object
  PFontClass* = ptr TFontClass
  TFontMapClass* {.pure, final.} = object
  PFontMapClass* = ptr TFontMapClass
  PFontDescription* = ptr TFontDescription
  TFontDescription* {.pure, final.} = object
  PAttrList* = ptr TAttrList
  TAttrList* {.pure, final.} = object
  PAttrIterator* = ptr TAttrIterator
  TAttrIterator* {.pure, final.} = object
  PLayout* = ptr TLayout
  TLayout* {.pure, final.} = object
  PLayoutClass* = ptr TLayoutClass
  TLayoutClass* {.pure, final.} = object
  PLayoutIter* = ptr TLayoutIter
  TLayoutIter* {.pure, final.} = object
  PContext* = ptr TContext
  TContext* {.pure, final.} = object
  PContextClass* = ptr TContextClass
  TContextClass* {.pure, final.} = object
  PFontsetSimple* = ptr TFontsetSimple
  TFontsetSimple* {.pure, final.} = object
  PTabArray* = ptr TTabArray
  TTabArray* {.pure, final.} = object
  PGlyphString* = ptr TGlyphString
  PAnalysis* = ptr TAnalysis
  PItem* = ptr TItem
  PLanguage* = ptr TLanguage
  TLanguage* {.pure, final.} = object
  PGlyph* = ptr TGlyph
  TGlyph* = guint32
  PRectangle* = ptr TRectangle
  TRectangle*{.final, pure.} = object 
    x*: int32
    y*: int32
    width*: int32
    height*: int32

  PDirection* = ptr TDirection
  TDirection* = enum 
    DIRECTION_LTR, DIRECTION_RTL, DIRECTION_TTB_LTR, DIRECTION_TTB_RTL
  PColor* = ptr TColor
  TColor*{.final, pure.} = object 
    red*: guint16
    green*: guint16
    blue*: guint16

  PAttrType* = ptr TAttrType
  TAttrType* = int32
  PUnderline* = ptr TUnderline
  TUnderline* = int32
  PAttribute* = ptr TAttribute
  PAttrClass* = ptr TAttrClass
  TAttribute*{.final, pure.} = object 
    klass*: PAttrClass
    start_index*: int
    end_index*: int

  TAttrClass*{.final, pure.} = object 
    `type`*: TAttrType
    copy*: proc (attr: PAttribute): PAttribute{.cdecl.}
    destroy*: proc (attr: PAttribute){.cdecl.}
    equal*: proc (attr1: PAttribute, attr2: PAttribute): gboolean{.cdecl.}

  PAttrString* = ptr TAttrString
  TAttrString*{.final, pure.} = object 
    attr*: TAttribute
    value*: cstring

  PAttrLanguage* = ptr TAttrLanguage
  TAttrLanguage*{.final, pure.} = object 
    attr*: TAttribute
    value*: PLanguage

  PAttrInt* = ptr TAttrInt
  TAttrInt*{.final, pure.} = object 
    attr*: TAttribute
    value*: int32

  PAttrFloat* = ptr TAttrFloat
  TAttrFloat*{.final, pure.} = object 
    attr*: TAttribute
    value*: gdouble

  PAttrColor* = ptr TAttrColor
  TAttrColor*{.final, pure.} = object 
    attr*: TAttribute
    color*: TColor

  PAttrShape* = ptr TAttrShape
  TAttrShape*{.final, pure.} = object 
    attr*: TAttribute
    ink_rect*: TRectangle
    logical_rect*: TRectangle

  PAttrFontDesc* = ptr TAttrFontDesc
  TAttrFontDesc*{.final, pure.} = object 
    attr*: TAttribute
    desc*: PFontDescription

  PLogAttr* = ptr TLogAttr
  TLogAttr*{.final, pure.} = object 
    flag0*: guint16

  PCoverageLevel* = ptr TCoverageLevel
  TCoverageLevel* = enum 
    COVERAGE_NONE, COVERAGE_FALLBACK, COVERAGE_APPROXIMATE, COVERAGE_EXACT
  PBlockInfo* = ptr TBlockInfo
  TBlockInfo*{.final, pure.} = object 
    data*: Pguchar
    level*: TCoverageLevel

  PCoverage* = ptr TCoverage
  TCoverage*{.final, pure.} = object 
    ref_count*: int
    n_blocks*: int32
    data_size*: int32
    blocks*: PBlockInfo

  PEngineRange* = ptr TEngineRange
  TEngineRange*{.final, pure.} = object 
    start*: int32
    theEnd*: int32
    langs*: cstring

  PEngineInfo* = ptr TEngineInfo
  TEngineInfo*{.final, pure.} = object 
    id*: cstring
    engine_type*: cstring
    render_type*: cstring
    ranges*: PEngineRange
    n_ranges*: gint

  PEngine* = ptr TEngine
  TEngine*{.final, pure.} = object 
    id*: cstring
    `type`*: cstring
    length*: gint

  TEngineLangScriptBreak* = proc (text: cstring, len: int32, 
                                  analysis: PAnalysis, attrs: PLogAttr, 
                                  attrs_len: int32){.cdecl.}
  PEngineLang* = ptr TEngineLang
  TEngineLang*{.final, pure.} = object 
    engine*: TEngine
    script_break*: TEngineLangScriptBreak

  TEngineShapeScript* = proc (font: PFont, text: cstring, length: int32, 
                              analysis: PAnalysis, glyphs: PGlyphString){.cdecl.}
  TEngineShapeGetCoverage* = proc (font: PFont, language: PLanguage): PCoverage{.
      cdecl.}
  PEngineShape* = ptr TEngineShape
  TEngineShape*{.final, pure.} = object 
    engine*: TEngine
    script_shape*: TEngineShapeScript
    get_coverage*: TEngineShapeGetCoverage

  PStyle* = ptr TStyle
  TStyle* = gint
  PVariant* = ptr TVariant
  TVariant* = gint
  PWeight* = ptr TWeight
  TWeight* = gint
  PStretch* = ptr TStretch
  TStretch* = gint
  PFontMask* = ptr TFontMask
  TFontMask* = int32
  PGlyphUnit* = ptr TGlyphUnit
  TGlyphUnit* = gint32
  PGlyphGeometry* = ptr TGlyphGeometry
  TGlyphGeometry*{.final, pure.} = object 
    width*: TGlyphUnit
    x_offset*: TGlyphUnit
    y_offset*: TGlyphUnit

  PGlyphVisAttr* = ptr TGlyphVisAttr
  TGlyphVisAttr*{.final, pure.} = object 
    flag0*: int16

  PGlyphInfo* = ptr TGlyphInfo
  TGlyphInfo*{.final, pure.} = object 
    glyph*: TGlyph
    geometry*: TGlyphGeometry
    attr*: TGlyphVisAttr

  TGlyphString*{.final, pure.} = object 
    num_glyphs*: gint
    glyphs*: PGlyphInfo
    log_clusters*: Pgint
    space*: gint

  TAnalysis*{.final, pure.} = object 
    shape_engine*: PEngineShape
    lang_engine*: PEngineLang
    font*: PFont
    level*: guint8
    language*: PLanguage
    extra_attrs*: PGSList

  TItem*{.final, pure.} = object 
    offset*: gint
    length*: gint
    num_chars*: gint
    analysis*: TAnalysis

  PAlignment* = ptr TAlignment
  TAlignment* = enum 
    ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT
  PWrapMode* = ptr TWrapMode
  TWrapMode* = enum 
    WRAP_WORD, WRAP_CHAR
  PLayoutLine* = ptr TLayoutLine
  TLayoutLine*{.final, pure.} = object 
    layout*: PLayout
    start_index*: gint
    length*: gint
    runs*: PGSList

  PLayoutRun* = ptr TLayoutRun
  TLayoutRun*{.final, pure.} = object 
    item*: PItem
    glyphs*: PGlyphString

  PTabAlign* = ptr TTabAlign
  TTabAlign* = enum 
    TAB_LEFT

const 
  SCALE* = 1024

proc PIXELS*(d: int): int
proc ASCENT*(rect: TRectangle): int32
proc DESCENT*(rect: TRectangle): int32
proc LBEARING*(rect: TRectangle): int32
proc RBEARING*(rect: TRectangle): int32
proc TYPE_LANGUAGE*(): GType
proc language_get_type*(): GType{.cdecl, dynlib: lib, 
                                  importc: "pango_language_get_type".}
proc language_from_string*(language: cstring): PLanguage{.cdecl, dynlib: lib, 
    importc: "pango_language_from_string".}
proc to_string*(language: PLanguage): cstring
proc matches*(language: PLanguage, range_list: cstring): gboolean{.
    cdecl, dynlib: lib, importc: "pango_language_matches".}
const 
  ATTR_INVALID* = 0
  ATTR_LANGUAGE* = 1
  ATTR_FAMILY* = 2
  ATTR_STYLE* = 3
  ATTR_WEIGHT* = 4
  ATTR_VARIANT* = 5
  ATTR_STRETCH* = 6
  ATTR_SIZE* = 7
  ATTR_FONT_DESC* = 8
  ATTR_FOREGROUND* = 9
  ATTR_BACKGROUND* = 10
  ATTR_UNDERLINE* = 11
  ATTR_STRIKETHROUGH* = 12
  ATTR_RISE* = 13
  ATTR_SHAPE* = 14
  ATTR_SCALE* = 15
  UNDERLINE_NONE* = 0
  UNDERLINE_SINGLE* = 1
  UNDERLINE_DOUBLE* = 2
  UNDERLINE_LOW* = 3

proc TYPE_COLOR*(): GType
proc color_get_type*(): GType{.cdecl, dynlib: lib, 
                               importc: "pango_color_get_type".}
proc copy*(src: PColor): PColor{.cdecl, dynlib: lib, 
                                       importc: "pango_color_copy".}
proc free*(color: PColor){.cdecl, dynlib: lib, importc: "pango_color_free".}
proc parse*(color: PColor, spec: cstring): gboolean{.cdecl, dynlib: lib, 
    importc: "pango_color_parse".}
proc TYPE_ATTR_LIST*(): GType
proc attr_type_register*(name: cstring): TAttrType{.cdecl, dynlib: lib, 
    importc: "pango_attr_type_register".}
proc copy*(attr: PAttribute): PAttribute{.cdecl, dynlib: lib, 
    importc: "pango_attribute_copy".}
proc destroy*(attr: PAttribute){.cdecl, dynlib: lib, 
    importc: "pango_attribute_destroy".}
proc equal*(attr1: PAttribute, attr2: PAttribute): gboolean{.cdecl, 
    dynlib: lib, importc: "pango_attribute_equal".}
proc attr_language_new*(language: PLanguage): PAttribute{.cdecl, dynlib: lib, 
    importc: "pango_attr_language_new".}
proc attr_family_new*(family: cstring): PAttribute{.cdecl, dynlib: lib, 
    importc: "pango_attr_family_new".}
proc attr_foreground_new*(red: guint16, green: guint16, blue: guint16): PAttribute{.
    cdecl, dynlib: lib, importc: "pango_attr_foreground_new".}
proc attr_background_new*(red: guint16, green: guint16, blue: guint16): PAttribute{.
    cdecl, dynlib: lib, importc: "pango_attr_background_new".}
proc attr_size_new*(size: int32): PAttribute{.cdecl, dynlib: lib, 
    importc: "pango_attr_size_new".}
proc attr_style_new*(style: TStyle): PAttribute{.cdecl, dynlib: lib, 
    importc: "pango_attr_style_new".}
proc attr_weight_new*(weight: TWeight): PAttribute{.cdecl, dynlib: lib, 
    importc: "pango_attr_weight_new".}
proc attr_variant_new*(variant: TVariant): PAttribute{.cdecl, dynlib: lib, 
    importc: "pango_attr_variant_new".}
proc attr_stretch_new*(stretch: TStretch): PAttribute{.cdecl, dynlib: lib, 
    importc: "pango_attr_stretch_new".}
proc attr_font_desc_new*(desc: PFontDescription): PAttribute{.cdecl, 
    dynlib: lib, importc: "pango_attr_font_desc_new".}
proc attr_underline_new*(underline: TUnderline): PAttribute{.cdecl, dynlib: lib, 
    importc: "pango_attr_underline_new".}
proc attr_strikethrough_new*(strikethrough: gboolean): PAttribute{.cdecl, 
    dynlib: lib, importc: "pango_attr_strikethrough_new".}
proc attr_rise_new*(rise: int32): PAttribute{.cdecl, dynlib: lib, 
    importc: "pango_attr_rise_new".}
proc attr_shape_new*(ink_rect: PRectangle, logical_rect: PRectangle): PAttribute{.
    cdecl, dynlib: lib, importc: "pango_attr_shape_new".}
proc attr_scale_new*(scale_factor: gdouble): PAttribute{.cdecl, dynlib: lib, 
    importc: "pango_attr_scale_new".}
proc attr_list_get_type*(): GType{.cdecl, dynlib: lib, 
                                   importc: "pango_attr_list_get_type".}
proc attr_list_new*(): PAttrList{.cdecl, dynlib: lib, 
                                  importc: "pango_attr_list_new".}
proc reference*(list: PAttrList){.cdecl, dynlib: lib, 
                                      importc: "pango_attr_list_ref".}
proc unref*(list: PAttrList){.cdecl, dynlib: lib, 
                                        importc: "pango_attr_list_unref".}
proc copy*(list: PAttrList): PAttrList{.cdecl, dynlib: lib, 
    importc: "pango_attr_list_copy".}
proc insert*(list: PAttrList, attr: PAttribute){.cdecl, dynlib: lib, 
    importc: "pango_attr_list_insert".}
proc insert_before*(list: PAttrList, attr: PAttribute){.cdecl, 
    dynlib: lib, importc: "pango_attr_list_insert_before".}
proc change*(list: PAttrList, attr: PAttribute){.cdecl, dynlib: lib, 
    importc: "pango_attr_list_change".}
proc splice*(list: PAttrList, other: PAttrList, pos: gint, len: gint){.
    cdecl, dynlib: lib, importc: "pango_attr_list_splice".}
proc get_iterator*(list: PAttrList): PAttrIterator{.cdecl, 
    dynlib: lib, importc: "pango_attr_list_get_iterator".}
proc attr_iterator_range*(`iterator`: PAttrIterator, start: Pgint, theEnd: Pgint){.
    cdecl, dynlib: lib, importc: "pango_attr_iterator_range".}
proc attr_iterator_next*(`iterator`: PAttrIterator): gboolean{.cdecl, 
    dynlib: lib, importc: "pango_attr_iterator_next".}
proc attr_iterator_copy*(`iterator`: PAttrIterator): PAttrIterator{.cdecl, 
    dynlib: lib, importc: "pango_attr_iterator_copy".}
proc attr_iterator_destroy*(`iterator`: PAttrIterator){.cdecl, dynlib: lib, 
    importc: "pango_attr_iterator_destroy".}
proc attr_iterator_get*(`iterator`: PAttrIterator, `type`: TAttrType): PAttribute{.
    cdecl, dynlib: lib, importc: "pango_attr_iterator_get".}
proc attr_iterator_get_font*(`iterator`: PAttrIterator, desc: PFontDescription, 
                             language: var PLanguage, extra_attrs: PPGSList){.
    cdecl, dynlib: lib, importc: "pango_attr_iterator_get_font".}
proc parse_markup*(markup_text: cstring, length: int32, accel_marker: gunichar, 
                   attr_list: var PAttrList, text: PPchar, 
                   accel_char: Pgunichar, error: pointer): gboolean{.cdecl, 
    dynlib: lib, importc: "pango_parse_markup".}
const 
  bm_TPangoLogAttr_is_line_break* = 0x0001'i16
  bp_TPangoLogAttr_is_line_break* = 0'i16
  bm_TPangoLogAttr_is_mandatory_break* = 0x0002'i16
  bp_TPangoLogAttr_is_mandatory_break* = 1'i16
  bm_TPangoLogAttr_is_char_break* = 0x0004'i16
  bp_TPangoLogAttr_is_char_break* = 2'i16
  bm_TPangoLogAttr_is_white* = 0x0008'i16
  bp_TPangoLogAttr_is_white* = 3'i16
  bm_TPangoLogAttr_is_cursor_position* = 0x0010'i16
  bp_TPangoLogAttr_is_cursor_position* = 4'i16
  bm_TPangoLogAttr_is_word_start* = 0x0020'i16
  bp_TPangoLogAttr_is_word_start* = 5'i16
  bm_TPangoLogAttr_is_word_end* = 0x0040'i16
  bp_TPangoLogAttr_is_word_end* = 6'i16
  bm_TPangoLogAttr_is_sentence_boundary* = 0x0080'i16
  bp_TPangoLogAttr_is_sentence_boundary* = 7'i16
  bm_TPangoLogAttr_is_sentence_start* = 0x0100'i16
  bp_TPangoLogAttr_is_sentence_start* = 8'i16
  bm_TPangoLogAttr_is_sentence_end* = 0x0200'i16
  bp_TPangoLogAttr_is_sentence_end* = 9'i16

proc is_line_break*(a: PLogAttr): guint
proc set_is_line_break*(a: PLogAttr, `is_line_break`: guint)
proc is_mandatory_break*(a: PLogAttr): guint
proc set_is_mandatory_break*(a: PLogAttr, `is_mandatory_break`: guint)
proc is_char_break*(a: PLogAttr): guint
proc set_is_char_break*(a: PLogAttr, `is_char_break`: guint)
proc is_white*(a: PLogAttr): guint
proc set_is_white*(a: PLogAttr, `is_white`: guint)
proc is_cursor_position*(a: PLogAttr): guint
proc set_is_cursor_position*(a: PLogAttr, `is_cursor_position`: guint)
proc is_word_start*(a: PLogAttr): guint
proc set_is_word_start*(a: PLogAttr, `is_word_start`: guint)
proc is_word_end*(a: PLogAttr): guint
proc set_is_word_end*(a: PLogAttr, `is_word_end`: guint)
proc is_sentence_boundary*(a: PLogAttr): guint
proc set_is_sentence_boundary*(a: PLogAttr, `is_sentence_boundary`: guint)
proc is_sentence_start*(a: PLogAttr): guint
proc set_is_sentence_start*(a: PLogAttr, `is_sentence_start`: guint)
proc is_sentence_end*(a: PLogAttr): guint
proc set_is_sentence_end*(a: PLogAttr, `is_sentence_end`: guint)
proc `break`*(text: cstring, length: int32, analysis: PAnalysis, attrs: PLogAttr, 
            attrs_len: int32){.cdecl, dynlib: lib, importc: "pango_break".}
proc find_paragraph_boundary*(text: cstring, length: gint, 
                              paragraph_delimiter_index: Pgint, 
                              next_paragraph_start: Pgint){.cdecl, dynlib: lib, 
    importc: "pango_find_paragraph_boundary".}
proc get_log_attrs*(text: cstring, length: int32, level: int32, 
                    language: PLanguage, log_attrs: PLogAttr, attrs_len: int32){.
    cdecl, dynlib: lib, importc: "pango_get_log_attrs".}
proc TYPE_CONTEXT*(): GType
proc CONTEXT*(anObject: pointer): PContext
proc CONTEXT_CLASS*(klass: pointer): PContextClass
proc IS_CONTEXT*(anObject: pointer): bool
proc IS_CONTEXT_CLASS*(klass: pointer): bool
proc GET_CLASS*(obj: PContext): PContextClass
proc context_get_type*(): GType{.cdecl, dynlib: lib, 
                                 importc: "pango_context_get_type".}
proc list_families*(context: PContext, 
                            families: openarray[ptr PFontFamily]){.cdecl, 
    dynlib: lib, importc: "pango_context_list_families".}
proc load_font*(context: PContext, desc: PFontDescription): PFont{.
    cdecl, dynlib: lib, importc: "pango_context_load_font".}
proc load_fontset*(context: PContext, desc: PFontDescription, 
                           language: PLanguage): PFontset{.cdecl, dynlib: lib, 
    importc: "pango_context_load_fontset".}
proc get_metrics*(context: PContext, desc: PFontDescription, 
                          language: PLanguage): PFontMetrics{.cdecl, 
    dynlib: lib, importc: "pango_context_get_metrics".}
proc set_font_description*(context: PContext, desc: PFontDescription){.
    cdecl, dynlib: lib, importc: "pango_context_set_font_description".}
proc get_font_description*(context: PContext): PFontDescription{.cdecl, 
    dynlib: lib, importc: "pango_context_get_font_description".}
proc get_language*(context: PContext): PLanguage{.cdecl, dynlib: lib, 
    importc: "pango_context_get_language".}
proc set_language*(context: PContext, language: PLanguage){.cdecl, 
    dynlib: lib, importc: "pango_context_set_language".}
proc set_base_dir*(context: PContext, direction: TDirection){.cdecl, 
    dynlib: lib, importc: "pango_context_set_base_dir".}
proc get_base_dir*(context: PContext): TDirection{.cdecl, dynlib: lib, 
    importc: "pango_context_get_base_dir".}
proc itemize*(context: PContext, text: cstring, start_index: int32, 
              length: int32, attrs: PAttrList, cached_iter: PAttrIterator): PGList{.
    cdecl, dynlib: lib, importc: "pango_itemize".}
proc coverage_new*(): PCoverage{.cdecl, dynlib: lib, 
                                 importc: "pango_coverage_new".}
proc reference*(coverage: PCoverage): PCoverage{.cdecl, dynlib: lib, 
    importc: "pango_coverage_ref".}
proc unref*(coverage: PCoverage){.cdecl, dynlib: lib, 
    importc: "pango_coverage_unref".}
proc copy*(coverage: PCoverage): PCoverage{.cdecl, dynlib: lib, 
    importc: "pango_coverage_copy".}
proc get*(coverage: PCoverage, index: int32): TCoverageLevel{.cdecl, 
    dynlib: lib, importc: "pango_coverage_get".}
proc set*(coverage: PCoverage, index: int32, level: TCoverageLevel){.
    cdecl, dynlib: lib, importc: "pango_coverage_set".}
proc max*(coverage: PCoverage, other: PCoverage){.cdecl, dynlib: lib, 
    importc: "pango_coverage_max".}
proc to_bytes*(coverage: PCoverage, bytes: PPguchar, n_bytes: var int32){.
    cdecl, dynlib: lib, importc: "pango_coverage_to_bytes".}
proc coverage_from_bytes*(bytes: Pguchar, n_bytes: int32): PCoverage{.cdecl, 
    dynlib: lib, importc: "pango_coverage_from_bytes".}
proc TYPE_FONTSET*(): GType
proc FONTSET*(anObject: pointer): PFontset
proc IS_FONTSET*(anObject: pointer): bool
proc fontset_get_type*(): GType{.cdecl, dynlib: lib, 
                                 importc: "pango_fontset_get_type".}
proc get_font*(fontset: PFontset, wc: guint): PFont{.cdecl, dynlib: lib, 
    importc: "pango_fontset_get_font".}
proc get_metrics*(fontset: PFontset): PFontMetrics{.cdecl, dynlib: lib, 
    importc: "pango_fontset_get_metrics".}
const 
  STYLE_NORMAL* = 0
  STYLE_OBLIQUE* = 1
  STYLE_ITALIC* = 2
  VARIANT_NORMAL* = 0
  VARIANT_SMALL_CAPS* = 1
  WEIGHT_ULTRALIGHT* = 200
  WEIGHT_LIGHT* = 300
  WEIGHT_NORMAL* = 400
  WEIGHT_BOLD* = 700
  WEIGHT_ULTRABOLD* = 800
  WEIGHT_HEAVY* = 900
  STRETCH_ULTRA_CONDENSED* = 0
  STRETCH_EXTRA_CONDENSED* = 1
  STRETCH_CONDENSED* = 2
  STRETCH_SEMI_CONDENSED* = 3
  STRETCH_NORMAL* = 4
  STRETCH_SEMI_EXPANDED* = 5
  STRETCH_EXPANDED* = 6
  STRETCH_EXTRA_EXPANDED* = 7
  STRETCH_ULTRA_EXPANDED* = 8
  FONT_MASK_FAMILY* = 1 shl 0
  FONT_MASK_STYLE* = 1 shl 1
  FONT_MASK_VARIANT* = 1 shl 2
  FONT_MASK_WEIGHT* = 1 shl 3
  FONT_MASK_STRETCH* = 1 shl 4
  FONT_MASK_SIZE* = 1 shl 5
  SCALE_XX_SMALL* = 0.578704
  SCALE_X_SMALL* = 0.644444
  SCALE_SMALL* = 0.833333
  SCALE_MEDIUM* = 1.00000
  SCALE_LARGE* = 1.20000
  SCALE_X_LARGE* = 1.44000
  SCALE_XX_LARGE* = 1.72800

proc TYPE_FONT_DESCRIPTION*(): GType
proc font_description_get_type*(): GType{.cdecl, dynlib: lib, 
    importc: "pango_font_description_get_type".}
proc font_description_new*(): PFontDescription{.cdecl, dynlib: lib, 
    importc: "pango_font_description_new".}
proc copy*(desc: PFontDescription): PFontDescription{.cdecl, 
    dynlib: lib, importc: "pango_font_description_copy".}
proc copy_static*(desc: PFontDescription): PFontDescription{.
    cdecl, dynlib: lib, importc: "pango_font_description_copy_static".}
proc hash*(desc: PFontDescription): guint{.cdecl, dynlib: lib, 
    importc: "pango_font_description_hash".}
proc equal*(desc1: PFontDescription, desc2: PFontDescription): gboolean{.
    cdecl, dynlib: lib, importc: "pango_font_description_equal".}
proc free*(desc: PFontDescription){.cdecl, dynlib: lib, 
    importc: "pango_font_description_free".}
proc font_descriptions_free*(descs: var PFontDescription, n_descs: int32){.
    cdecl, dynlib: lib, importc: "pango_font_descriptions_free".}
proc set_family*(desc: PFontDescription, family: cstring){.
    cdecl, dynlib: lib, importc: "pango_font_description_set_family".}
proc set_family_static*(desc: PFontDescription, family: cstring){.
    cdecl, dynlib: lib, importc: "pango_font_description_set_family_static".}
proc get_family*(desc: PFontDescription): cstring{.cdecl, 
    dynlib: lib, importc: "pango_font_description_get_family".}
proc set_style*(desc: PFontDescription, style: TStyle){.cdecl, 
    dynlib: lib, importc: "pango_font_description_set_style".}
proc get_style*(desc: PFontDescription): TStyle{.cdecl, 
    dynlib: lib, importc: "pango_font_description_get_style".}
proc set_variant*(desc: PFontDescription, variant: TVariant){.
    cdecl, dynlib: lib, importc: "pango_font_description_set_variant".}
proc get_variant*(desc: PFontDescription): TVariant{.cdecl, 
    dynlib: lib, importc: "pango_font_description_get_variant".}
proc set_weight*(desc: PFontDescription, weight: TWeight){.
    cdecl, dynlib: lib, importc: "pango_font_description_set_weight".}
proc get_weight*(desc: PFontDescription): TWeight{.cdecl, 
    dynlib: lib, importc: "pango_font_description_get_weight".}
proc set_stretch*(desc: PFontDescription, stretch: TStretch){.
    cdecl, dynlib: lib, importc: "pango_font_description_set_stretch".}
proc get_stretch*(desc: PFontDescription): TStretch{.cdecl, 
    dynlib: lib, importc: "pango_font_description_get_stretch".}
proc set_size*(desc: PFontDescription, size: gint){.cdecl, 
    dynlib: lib, importc: "pango_font_description_set_size".}
proc get_size*(desc: PFontDescription): gint{.cdecl, 
    dynlib: lib, importc: "pango_font_description_get_size".}
proc set_absolute_size*(desc: PFontDescription, size: float64){.
    cdecl, dynlib: lib, importc: "pango_font_description_set_absolute_size".}
proc get_size_is_absolute*(desc: PFontDescription, 
    size: float64): gboolean{.cdecl, dynlib: lib, importc: "pango_font_description_get_size_is_absolute".}
proc get_set_fields*(desc: PFontDescription): TFontMask{.cdecl, 
    dynlib: lib, importc: "pango_font_description_get_set_fields".}
proc unset_fields*(desc: PFontDescription, to_unset: TFontMask){.
    cdecl, dynlib: lib, importc: "pango_font_description_unset_fields".}
proc merge*(desc: PFontDescription, 
                             desc_to_merge: PFontDescription, 
                             replace_existing: gboolean){.cdecl, dynlib: lib, 
    importc: "pango_font_description_merge".}
proc merge_static*(desc: PFontDescription, 
                                    desc_to_merge: PFontDescription, 
                                    replace_existing: gboolean){.cdecl, 
    dynlib: lib, importc: "pango_font_description_merge_static".}
proc better_match*(desc: PFontDescription, 
                                    old_match: PFontDescription, 
                                    new_match: PFontDescription): gboolean{.
    cdecl, dynlib: lib, importc: "pango_font_description_better_match".}
proc font_description_from_string*(str: cstring): PFontDescription{.cdecl, 
    dynlib: lib, importc: "pango_font_description_from_string".}
proc to_string*(desc: PFontDescription): cstring{.cdecl, 
    dynlib: lib, importc: "pango_font_description_to_string".}
proc to_filename*(desc: PFontDescription): cstring{.cdecl, 
    dynlib: lib, importc: "pango_font_description_to_filename".}
proc TYPE_FONT_METRICS*(): GType
proc font_metrics_get_type*(): GType{.cdecl, dynlib: lib, 
                                      importc: "pango_font_metrics_get_type".}
proc reference*(metrics: PFontMetrics): PFontMetrics{.cdecl, dynlib: lib, 
    importc: "pango_font_metrics_ref".}
proc unref*(metrics: PFontMetrics){.cdecl, dynlib: lib, 
    importc: "pango_font_metrics_unref".}
proc get_ascent*(metrics: PFontMetrics): int32{.cdecl, dynlib: lib, 
    importc: "pango_font_metrics_get_ascent".}
proc get_descent*(metrics: PFontMetrics): int32{.cdecl, 
    dynlib: lib, importc: "pango_font_metrics_get_descent".}
proc get_approximate_char_width*(metrics: PFontMetrics): int32{.
    cdecl, dynlib: lib, importc: "pango_font_metrics_get_approximate_char_width".}
proc get_approximate_digit_width*(metrics: PFontMetrics): int32{.
    cdecl, dynlib: lib, 
    importc: "pango_font_metrics_get_approximate_digit_width".}
proc TYPE_FONT_FAMILY*(): GType
proc FONT_FAMILY*(anObject: Pointer): PFontFamily
proc IS_FONT_FAMILY*(anObject: Pointer): bool
proc font_family_get_type*(): GType{.cdecl, dynlib: lib, 
                                     importc: "pango_font_family_get_type".}
proc list_faces*(family: PFontFamily, 
                             faces: var openarray[ptr PFontFace]){.cdecl, 
    dynlib: lib, importc: "pango_font_family_list_faces".}
proc get_name*(family: PFontFamily): cstring{.cdecl, dynlib: lib, 
    importc: "pango_font_family_get_name".}
proc TYPE_FONT_FACE*(): GType
proc FONT_FACE*(anObject: pointer): PFontFace
proc IS_FONT_FACE*(anObject: pointer): bool
proc font_face_get_type*(): GType{.cdecl, dynlib: lib, 
                                   importc: "pango_font_face_get_type".}
proc describe*(face: PFontFace): PFontDescription{.cdecl, dynlib: lib, 
    importc: "pango_font_face_describe".}
proc get_face_name*(face: PFontFace): cstring{.cdecl, dynlib: lib, 
    importc: "pango_font_face_get_face_name".}
proc TYPE_FONT*(): GType
proc FONT*(anObject: pointer): PFont
proc IS_FONT*(anObject: pointer): bool
proc font_get_type*(): GType{.cdecl, dynlib: lib, importc: "pango_font_get_type".}
proc describe*(font: PFont): PFontDescription{.cdecl, dynlib: lib, 
    importc: "pango_font_describe".}
proc get_coverage*(font: PFont, language: PLanguage): PCoverage{.cdecl, 
    dynlib: lib, importc: "pango_font_get_coverage".}
proc find_shaper*(font: PFont, language: PLanguage, ch: guint32): PEngineShape{.
    cdecl, dynlib: lib, importc: "pango_font_find_shaper".}
proc get_metrics*(font: PFont, language: PLanguage): PFontMetrics{.cdecl, 
    dynlib: lib, importc: "pango_font_get_metrics".}
proc get_glyph_extents*(font: PFont, glyph: TGlyph, ink_rect: PRectangle, 
                             logical_rect: PRectangle){.cdecl, dynlib: lib, 
    importc: "pango_font_get_glyph_extents".}
proc TYPE_FONT_MAP*(): GType
proc FONT_MAP*(anObject: pointer): PFontMap
proc IS_FONT_MAP*(anObject: pointer): bool
proc font_map_get_type*(): GType{.cdecl, dynlib: lib, 
                                  importc: "pango_font_map_get_type".}
proc load_font*(fontmap: PFontMap, context: PContext, 
                         desc: PFontDescription): PFont{.cdecl, dynlib: lib, 
    importc: "pango_font_map_load_font".}
proc load_fontset*(fontmap: PFontMap, context: PContext, 
                            desc: PFontDescription, language: PLanguage): PFontset{.
    cdecl, dynlib: lib, importc: "pango_font_map_load_fontset".}
proc list_families*(fontmap: PFontMap, 
                             families: var openarray[ptr PFontFamily]){.cdecl, 
    dynlib: lib, importc: "pango_font_map_list_families".}
const 
  bm_TPangoGlyphVisAttr_is_cluster_start* = 0x0001'i16
  bp_TPangoGlyphVisAttr_is_cluster_start* = 0'i16

proc is_cluster_start*(a: PGlyphVisAttr): guint
proc set_is_cluster_start*(a: PGlyphVisAttr, `is_cluster_start`: guint)
proc TYPE_GLYPH_STRING*(): GType
proc glyph_string_new*(): PGlyphString{.cdecl, dynlib: lib, 
                                        importc: "pango_glyph_string_new".}
proc glyph_string_set_size*(`string`: PGlyphString, new_len: gint){.cdecl, 
    dynlib: lib, importc: "pango_glyph_string_set_size".}
proc glyph_string_get_type*(): GType{.cdecl, dynlib: lib, 
                                      importc: "pango_glyph_string_get_type".}
proc glyph_string_copy*(`string`: PGlyphString): PGlyphString{.cdecl, 
    dynlib: lib, importc: "pango_glyph_string_copy".}
proc glyph_string_free*(`string`: PGlyphString){.cdecl, dynlib: lib, 
    importc: "pango_glyph_string_free".}
proc extents*(glyphs: PGlyphString, font: PFont, 
                           ink_rect: PRectangle, logical_rect: PRectangle){.
    cdecl, dynlib: lib, importc: "pango_glyph_string_extents".}
proc extents_range*(glyphs: PGlyphString, start: int32, 
                                 theEnd: int32, font: PFont, 
                                 ink_rect: PRectangle, logical_rect: PRectangle){.
    cdecl, dynlib: lib, importc: "pango_glyph_string_extents_range".}
proc get_logical_widths*(glyphs: PGlyphString, text: cstring, 
                                      length: int32, embedding_level: int32, 
                                      logical_widths: var int32){.cdecl, 
    dynlib: lib, importc: "pango_glyph_string_get_logical_widths".}
proc index_to_x*(glyphs: PGlyphString, text: cstring, 
                              length: int32, analysis: PAnalysis, index: int32, 
                              trailing: gboolean, x_pos: var int32){.cdecl, 
    dynlib: lib, importc: "pango_glyph_string_index_to_x".}
proc x_to_index*(glyphs: PGlyphString, text: cstring, 
                              length: int32, analysis: PAnalysis, x_pos: int32, 
                              index, trailing: var int32){.cdecl, dynlib: lib, 
    importc: "pango_glyph_string_x_to_index".}
proc shape*(text: cstring, length: gint, analysis: PAnalysis, 
            glyphs: PGlyphString){.cdecl, dynlib: lib, importc: "pango_shape".}
proc reorder_items*(logical_items: PGList): PGList{.cdecl, dynlib: lib, 
    importc: "pango_reorder_items".}
proc item_new*(): PItem{.cdecl, dynlib: lib, importc: "pango_item_new".}
proc copy*(item: PItem): PItem{.cdecl, dynlib: lib, 
                                     importc: "pango_item_copy".}
proc free*(item: PItem){.cdecl, dynlib: lib, importc: "pango_item_free".}
proc split*(orig: PItem, split_index: int32, split_offset: int32): PItem{.
    cdecl, dynlib: lib, importc: "pango_item_split".}
proc TYPE_LAYOUT*(): GType
proc LAYOUT*(anObject: pointer): PLayout
proc LAYOUT_CLASS*(klass: pointer): PLayoutClass
proc IS_LAYOUT*(anObject: pointer): bool
proc IS_LAYOUT_CLASS*(klass: pointer): bool
proc GET_CLASS*(obj: PLayout): PLayoutClass
proc layout_get_type*(): GType{.cdecl, dynlib: lib, 
                                importc: "pango_layout_get_type".}
proc layout_new*(context: PContext): PLayout{.cdecl, dynlib: lib, 
    importc: "pango_layout_new".}
proc copy*(src: PLayout): PLayout{.cdecl, dynlib: lib, 
    importc: "pango_layout_copy".}
proc get_context*(layout: PLayout): PContext{.cdecl, dynlib: lib, 
    importc: "pango_layout_get_context".}
proc set_attributes*(layout: PLayout, attrs: PAttrList){.cdecl, 
    dynlib: lib, importc: "pango_layout_set_attributes".}
proc get_attributes*(layout: PLayout): PAttrList{.cdecl, dynlib: lib, 
    importc: "pango_layout_get_attributes".}
proc set_text*(layout: PLayout, text: cstring, length: int32){.cdecl, 
    dynlib: lib, importc: "pango_layout_set_text".}
proc get_text*(layout: PLayout): cstring{.cdecl, dynlib: lib, 
    importc: "pango_layout_get_text".}
proc set_markup*(layout: PLayout, markup: cstring, length: int32){.cdecl, 
    dynlib: lib, importc: "pango_layout_set_markup".}
proc set_markup*(layout: PLayout, markup: cstring, 
                                   length: int32, accel_marker: gunichar, 
                                   accel_char: Pgunichar){.cdecl, dynlib: lib, 
    importc: "pango_layout_set_markup_with_accel".}
proc set_font_description*(layout: PLayout, desc: PFontDescription){.
    cdecl, dynlib: lib, importc: "pango_layout_set_font_description".}
proc set_width*(layout: PLayout, width: int32){.cdecl, dynlib: lib, 
    importc: "pango_layout_set_width".}
proc get_width*(layout: PLayout): int32{.cdecl, dynlib: lib, 
    importc: "pango_layout_get_width".}
proc set_wrap*(layout: PLayout, wrap: TWrapMode){.cdecl, dynlib: lib, 
    importc: "pango_layout_set_wrap".}
proc get_wrap*(layout: PLayout): TWrapMode{.cdecl, dynlib: lib, 
    importc: "pango_layout_get_wrap".}
proc set_indent*(layout: PLayout, indent: int32){.cdecl, dynlib: lib, 
    importc: "pango_layout_set_indent".}
proc get_indent*(layout: PLayout): int32{.cdecl, dynlib: lib, 
    importc: "pango_layout_get_indent".}
proc set_spacing*(layout: PLayout, spacing: int32){.cdecl, dynlib: lib, 
    importc: "pango_layout_set_spacing".}
proc get_spacing*(layout: PLayout): int32{.cdecl, dynlib: lib, 
    importc: "pango_layout_get_spacing".}
proc set_justify*(layout: PLayout, justify: gboolean){.cdecl, 
    dynlib: lib, importc: "pango_layout_set_justify".}
proc get_justify*(layout: PLayout): gboolean{.cdecl, dynlib: lib, 
    importc: "pango_layout_get_justify".}
proc set_alignment*(layout: PLayout, alignment: TAlignment){.cdecl, 
    dynlib: lib, importc: "pango_layout_set_alignment".}
proc get_alignment*(layout: PLayout): TAlignment{.cdecl, dynlib: lib, 
    importc: "pango_layout_get_alignment".}
proc set_tabs*(layout: PLayout, tabs: PTabArray){.cdecl, dynlib: lib, 
    importc: "pango_layout_set_tabs".}
proc get_tabs*(layout: PLayout): PTabArray{.cdecl, dynlib: lib, 
    importc: "pango_layout_get_tabs".}
proc set_single_paragraph_mode*(layout: PLayout, setting: gboolean){.
    cdecl, dynlib: lib, importc: "pango_layout_set_single_paragraph_mode".}
proc get_single_paragraph_mode*(layout: PLayout): gboolean{.cdecl, 
    dynlib: lib, importc: "pango_layout_get_single_paragraph_mode".}
proc context_changed*(layout: PLayout){.cdecl, dynlib: lib, 
    importc: "pango_layout_context_changed".}
proc get_log_attrs*(layout: PLayout, attrs: var PLogAttr, n_attrs: Pgint){.
    cdecl, dynlib: lib, importc: "pango_layout_get_log_attrs".}
proc index_to_pos*(layout: PLayout, index: int32, pos: PRectangle){.
    cdecl, dynlib: lib, importc: "pango_layout_index_to_pos".}
proc get_cursor_pos*(layout: PLayout, index: int32, 
                            strong_pos: PRectangle, weak_pos: PRectangle){.
    cdecl, dynlib: lib, importc: "pango_layout_get_cursor_pos".}
proc move_cursor_visually*(layout: PLayout, strong: gboolean, 
                                  old_index: int32, old_trailing: int32, 
                                  direction: int32, 
                                  new_index, new_trailing: var int32){.cdecl, 
    dynlib: lib, importc: "pango_layout_move_cursor_visually".}
proc xy_to_index*(layout: PLayout, x: int32, y: int32, 
                         index, trailing: var int32): gboolean{.cdecl, 
    dynlib: lib, importc: "pango_layout_xy_to_index".}
proc get_extents*(layout: PLayout, ink_rect: PRectangle, 
                         logical_rect: PRectangle){.cdecl, dynlib: lib, 
    importc: "pango_layout_get_extents".}
proc get_pixel_extents*(layout: PLayout, ink_rect: PRectangle, 
                               logical_rect: PRectangle){.cdecl, dynlib: lib, 
    importc: "pango_layout_get_pixel_extents".}
proc get_size*(layout: PLayout, width: var int32, height: var int32){.
    cdecl, dynlib: lib, importc: "pango_layout_get_size".}
proc get_pixel_size*(layout: PLayout, width: var int32, height: var int32){.
    cdecl, dynlib: lib, importc: "pango_layout_get_pixel_size".}
proc get_line_count*(layout: PLayout): int32{.cdecl, dynlib: lib, 
    importc: "pango_layout_get_line_count".}
proc get_line*(layout: PLayout, line: int32): PLayoutLine{.cdecl, 
    dynlib: lib, importc: "pango_layout_get_line".}
proc get_lines*(layout: PLayout): PGSList{.cdecl, dynlib: lib, 
    importc: "pango_layout_get_lines".}
proc reference*(line: PLayoutLine){.cdecl, dynlib: lib, 
    importc: "pango_layout_line_ref".}
proc unref*(line: PLayoutLine){.cdecl, dynlib: lib, 
    importc: "pango_layout_line_unref".}
proc x_to_index*(line: PLayoutLine, x_pos: int32, index: var int32, 
                             trailing: var int32): gboolean{.cdecl, dynlib: lib, 
    importc: "pango_layout_line_x_to_index".}
proc index_to_x*(line: PLayoutLine, index: int32, 
                             trailing: gboolean, x_pos: var int32){.cdecl, 
    dynlib: lib, importc: "pango_layout_line_index_to_x".}
proc get_extents*(line: PLayoutLine, ink_rect: PRectangle, 
                              logical_rect: PRectangle){.cdecl, dynlib: lib, 
    importc: "pango_layout_line_get_extents".}
proc get_pixel_extents*(layout_line: PLayoutLine, 
                                    ink_rect: PRectangle, 
                                    logical_rect: PRectangle){.cdecl, 
    dynlib: lib, importc: "pango_layout_line_get_pixel_extents".}
proc get_iter*(layout: PLayout): PLayoutIter{.cdecl, dynlib: lib, 
    importc: "pango_layout_get_iter".}
proc free*(iter: PLayoutIter){.cdecl, dynlib: lib, 
    importc: "pango_layout_iter_free".}
proc get_index*(iter: PLayoutIter): int32{.cdecl, dynlib: lib, 
    importc: "pango_layout_iter_get_index".}
proc get_run*(iter: PLayoutIter): PLayoutRun{.cdecl, dynlib: lib, 
    importc: "pango_layout_iter_get_run".}
proc get_line*(iter: PLayoutIter): PLayoutLine{.cdecl, dynlib: lib, 
    importc: "pango_layout_iter_get_line".}
proc at_last_line*(iter: PLayoutIter): gboolean{.cdecl, dynlib: lib, 
    importc: "pango_layout_iter_at_last_line".}
proc next_char*(iter: PLayoutIter): gboolean{.cdecl, dynlib: lib, 
    importc: "pango_layout_iter_next_char".}
proc next_cluster*(iter: PLayoutIter): gboolean{.cdecl, dynlib: lib, 
    importc: "pango_layout_iter_next_cluster".}
proc next_run*(iter: PLayoutIter): gboolean{.cdecl, dynlib: lib, 
    importc: "pango_layout_iter_next_run".}
proc next_line*(iter: PLayoutIter): gboolean{.cdecl, dynlib: lib, 
    importc: "pango_layout_iter_next_line".}
proc get_char_extents*(iter: PLayoutIter, logical_rect: PRectangle){.
    cdecl, dynlib: lib, importc: "pango_layout_iter_get_char_extents".}
proc get_cluster_extents*(iter: PLayoutIter, ink_rect: PRectangle, 
                                      logical_rect: PRectangle){.cdecl, 
    dynlib: lib, importc: "pango_layout_iter_get_cluster_extents".}
proc get_run_extents*(iter: PLayoutIter, ink_rect: PRectangle, 
                                  logical_rect: PRectangle){.cdecl, dynlib: lib, 
    importc: "pango_layout_iter_get_run_extents".}
proc get_line_extents*(iter: PLayoutIter, ink_rect: PRectangle, 
                                   logical_rect: PRectangle){.cdecl, 
    dynlib: lib, importc: "pango_layout_iter_get_line_extents".}
proc get_line_yrange*(iter: PLayoutIter, y0: var int32, 
                                  y1: var int32){.cdecl, dynlib: lib, 
    importc: "pango_layout_iter_get_line_yrange".}
proc get_layout_extents*(iter: PLayoutIter, ink_rect: PRectangle, 
                                     logical_rect: PRectangle){.cdecl, 
    dynlib: lib, importc: "pango_layout_iter_get_layout_extents".}
proc get_baseline*(iter: PLayoutIter): int32{.cdecl, dynlib: lib, 
    importc: "pango_layout_iter_get_baseline".}
proc TYPE_TAB_ARRAY*(): GType
proc tab_array_new*(initial_size: gint, positions_in_pixels: gboolean): PTabArray{.
    cdecl, dynlib: lib, importc: "pango_tab_array_new".}
proc tab_array_get_type*(): GType{.cdecl, dynlib: lib, 
                                   importc: "pango_tab_array_get_type".}
proc copy*(src: PTabArray): PTabArray{.cdecl, dynlib: lib, 
    importc: "pango_tab_array_copy".}
proc free*(tab_array: PTabArray){.cdecl, dynlib: lib, 
    importc: "pango_tab_array_free".}
proc get_size*(tab_array: PTabArray): gint{.cdecl, dynlib: lib, 
    importc: "pango_tab_array_get_size".}
proc resize*(tab_array: PTabArray, new_size: gint){.cdecl, 
    dynlib: lib, importc: "pango_tab_array_resize".}
proc set_tab*(tab_array: PTabArray, tab_index: gint, 
                        alignment: TTabAlign, location: gint){.cdecl, 
    dynlib: lib, importc: "pango_tab_array_set_tab".}
proc get_tab*(tab_array: PTabArray, tab_index: gint, 
                        alignment: PTabAlign, location: Pgint){.cdecl, 
    dynlib: lib, importc: "pango_tab_array_get_tab".}
proc get_positions_in_pixels*(tab_array: PTabArray): gboolean{.cdecl, 
    dynlib: lib, importc: "pango_tab_array_get_positions_in_pixels".}
proc ASCENT*(rect: TRectangle): int32 = 
  result = -rect.y

proc DESCENT*(rect: TRectangle): int32 = 
  result = (rect.y) + (rect.height)

proc LBEARING*(rect: TRectangle): int32 = 
  result = rect.x

proc RBEARING*(rect: TRectangle): int32 = 
  result = (rect.x) + (rect.width)

proc TYPE_LANGUAGE*(): GType = 
  result = language_get_type()

proc to_string*(language: PLanguage): cstring = 
  result = cast[cstring](language)

proc PIXELS*(d: int): int = 
  if d >= 0: 
    result = (d + (SCALE div 2)) div SCALE
  else: 
    result = (d - (SCALE div 2)) div SCALE

proc TYPE_COLOR*(): GType = 
  result = color_get_type()

proc TYPE_ATTR_LIST*(): GType = 
  result = attr_list_get_type()

proc is_line_break*(a: PLogAttr): guint = 
  result = (a.flag0 and bm_TPangoLogAttr_is_line_break) shr
      bp_TPangoLogAttr_is_line_break

proc set_is_line_break*(a: PLogAttr, `is_line_break`: guint) = 
  a.flag0 = a.flag0 or
      (int16(`is_line_break` shl bp_TPangoLogAttr_is_line_break) and
      bm_TPangoLogAttr_is_line_break)

proc is_mandatory_break*(a: PLogAttr): guint = 
  result = (a.flag0 and bm_TPangoLogAttr_is_mandatory_break) shr
      bp_TPangoLogAttr_is_mandatory_break

proc set_is_mandatory_break*(a: PLogAttr, `is_mandatory_break`: guint) = 
  a.flag0 = a.flag0 or
      (int16(`is_mandatory_break` shl bp_TPangoLogAttr_is_mandatory_break) and
      bm_TPangoLogAttr_is_mandatory_break)

proc is_char_break*(a: PLogAttr): guint = 
  result = (a.flag0 and bm_TPangoLogAttr_is_char_break) shr
      bp_TPangoLogAttr_is_char_break

proc set_is_char_break*(a: PLogAttr, `is_char_break`: guint) = 
  a.flag0 = a.flag0 or
      (int16(`is_char_break` shl bp_TPangoLogAttr_is_char_break) and
      bm_TPangoLogAttr_is_char_break)

proc is_white*(a: PLogAttr): guint = 
  result = (a.flag0 and bm_TPangoLogAttr_is_white) shr
      bp_TPangoLogAttr_is_white

proc set_is_white*(a: PLogAttr, `is_white`: guint) = 
  a.flag0 = a.flag0 or
      (int16(`is_white` shl bp_TPangoLogAttr_is_white) and
      bm_TPangoLogAttr_is_white)

proc is_cursor_position*(a: PLogAttr): guint = 
  result = (a.flag0 and bm_TPangoLogAttr_is_cursor_position) shr
      bp_TPangoLogAttr_is_cursor_position

proc set_is_cursor_position*(a: PLogAttr, `is_cursor_position`: guint) = 
  a.flag0 = a.flag0 or
      (int16(`is_cursor_position` shl bp_TPangoLogAttr_is_cursor_position) and
      bm_TPangoLogAttr_is_cursor_position)

proc is_word_start*(a: PLogAttr): guint = 
  result = (a.flag0 and bm_TPangoLogAttr_is_word_start) shr
      bp_TPangoLogAttr_is_word_start

proc set_is_word_start*(a: PLogAttr, `is_word_start`: guint) = 
  a.flag0 = a.flag0 or
      (int16(`is_word_start` shl bp_TPangoLogAttr_is_word_start) and
      bm_TPangoLogAttr_is_word_start)

proc is_word_end*(a: PLogAttr): guint = 
  result = (a.flag0 and bm_TPangoLogAttr_is_word_end) shr
      bp_TPangoLogAttr_is_word_end

proc set_is_word_end*(a: PLogAttr, `is_word_end`: guint) = 
  a.flag0 = a.flag0 or
      (int16(`is_word_end` shl bp_TPangoLogAttr_is_word_end) and
      bm_TPangoLogAttr_is_word_end)

proc is_sentence_boundary*(a: PLogAttr): guint = 
  result = (a.flag0 and bm_TPangoLogAttr_is_sentence_boundary) shr
      bp_TPangoLogAttr_is_sentence_boundary

proc set_is_sentence_boundary*(a: PLogAttr, `is_sentence_boundary`: guint) = 
  a.flag0 = a.flag0 or
      (int16(`is_sentence_boundary` shl bp_TPangoLogAttr_is_sentence_boundary) and
      bm_TPangoLogAttr_is_sentence_boundary)

proc is_sentence_start*(a: PLogAttr): guint = 
  result = (a.flag0 and bm_TPangoLogAttr_is_sentence_start) shr
      bp_TPangoLogAttr_is_sentence_start

proc set_is_sentence_start*(a: PLogAttr, `is_sentence_start`: guint) = 
  a.flag0 = a.flag0 or
      (int16(`is_sentence_start` shl bp_TPangoLogAttr_is_sentence_start) and
      bm_TPangoLogAttr_is_sentence_start)

proc is_sentence_end*(a: PLogAttr): guint = 
  result = (a.flag0 and bm_TPangoLogAttr_is_sentence_end) shr
      bp_TPangoLogAttr_is_sentence_end

proc set_is_sentence_end*(a: PLogAttr, `is_sentence_end`: guint) = 
  a.flag0 = a.flag0 or
      (int16(`is_sentence_end` shl bp_TPangoLogAttr_is_sentence_end) and
      bm_TPangoLogAttr_is_sentence_end)

proc TYPE_CONTEXT*(): GType = 
  result = context_get_type()

proc CONTEXT*(anObject: pointer): PContext = 
  result = cast[PContext](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_CONTEXT()))

proc CONTEXT_CLASS*(klass: pointer): PContextClass = 
  result = cast[PContextClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_CONTEXT()))

proc IS_CONTEXT*(anObject: pointer): bool = 
  result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_CONTEXT())

proc IS_CONTEXT_CLASS*(klass: pointer): bool = 
  result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_CONTEXT())

proc GET_CLASS*(obj: PContext): PContextClass = 
  result = cast[PContextClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_CONTEXT()))

proc TYPE_FONTSET*(): GType = 
  result = fontset_get_type()

proc FONTSET*(anObject: pointer): PFontset = 
  result = cast[PFontset](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_FONTSET()))

proc IS_FONTSET*(anObject: pointer): bool = 
  result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_FONTSET())

proc FONTSET_CLASS*(klass: pointer): PFontsetClass = 
  result = cast[PFontsetClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_FONTSET()))

proc IS_FONTSET_CLASS*(klass: pointer): bool = 
  result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_FONTSET())

proc GET_CLASS*(obj: PFontset): PFontsetClass = 
  result = cast[PFontsetClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_FONTSET()))

proc fontset_simple_get_type(): GType{.importc: "pango_fontset_simple_get_type", 
                                       cdecl, dynlib: lib.}
proc TYPE_FONTSET_SIMPLE*(): GType = 
  result = fontset_simple_get_type()

proc FONTSET_SIMPLE*(anObject: pointer): PFontsetSimple = 
  result = cast[PFontsetSimple](G_TYPE_CHECK_INSTANCE_CAST(anObject, 
      TYPE_FONTSET_SIMPLE()))

proc IS_FONTSET_SIMPLE*(anObject: pointer): bool = 
  result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_FONTSET_SIMPLE())

proc TYPE_FONT_DESCRIPTION*(): GType = 
  result = font_description_get_type()

proc TYPE_FONT_METRICS*(): GType = 
  result = font_metrics_get_type()

proc TYPE_FONT_FAMILY*(): GType = 
  result = font_family_get_type()

proc FONT_FAMILY*(anObject: pointer): PFontFamily = 
  result = cast[PFontFamily](G_TYPE_CHECK_INSTANCE_CAST(anObject, 
      TYPE_FONT_FAMILY()))

proc IS_FONT_FAMILY*(anObject: Pointer): bool = 
  result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_FONT_FAMILY())

proc FONT_FAMILY_CLASS*(klass: Pointer): PFontFamilyClass = 
  result = cast[PFontFamilyClass](G_TYPE_CHECK_CLASS_CAST(klass, 
      TYPE_FONT_FAMILY()))

proc IS_FONT_FAMILY_CLASS*(klass: Pointer): bool = 
  result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_FONT_FAMILY())

proc GET_CLASS*(obj: PFontFamily): PFontFamilyClass = 
  result = cast[PFontFamilyClass](G_TYPE_INSTANCE_GET_CLASS(obj, 
      TYPE_FONT_FAMILY()))

proc TYPE_FONT_FACE*(): GType = 
  result = font_face_get_type()

proc FONT_FACE*(anObject: Pointer): PFontFace = 
  result = cast[PFontFace](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_FONT_FACE()))

proc IS_FONT_FACE*(anObject: Pointer): bool = 
  result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_FONT_FACE())

proc FONT_FACE_CLASS*(klass: Pointer): PFontFaceClass = 
  result = cast[PFontFaceClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_FONT_FACE()))

proc IS_FONT_FACE_CLASS*(klass: Pointer): bool = 
  result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_FONT_FACE())

proc FONT_FACE_GET_CLASS*(obj: Pointer): PFontFaceClass = 
  result = cast[PFontFaceClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_FONT_FACE()))

proc TYPE_FONT*(): GType = 
  result = font_get_type()

proc FONT*(anObject: Pointer): PFont = 
  result = cast[PFont](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_FONT()))

proc IS_FONT*(anObject: Pointer): bool = 
  result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_FONT())

proc FONT_CLASS*(klass: Pointer): PFontClass = 
  result = cast[PFontClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_FONT()))

proc IS_FONT_CLASS*(klass: Pointer): bool = 
  result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_FONT())

proc GET_CLASS*(obj: PFont): PFontClass = 
  result = cast[PFontClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_FONT()))

proc TYPE_FONT_MAP*(): GType = 
  result = font_map_get_type()

proc FONT_MAP*(anObject: pointer): PFontmap = 
  result = cast[PFontmap](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_FONT_MAP()))

proc IS_FONT_MAP*(anObject: pointer): bool = 
  result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_FONT_MAP())

proc FONT_MAP_CLASS*(klass: pointer): PFontMapClass = 
  result = cast[PFontMapClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_FONT_MAP()))

proc IS_FONT_MAP_CLASS*(klass: pointer): bool = 
  result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_FONT_MAP())

proc GET_CLASS*(obj: PFontMap): PFontMapClass = 
  result = cast[PFontMapClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_FONT_MAP()))

proc is_cluster_start*(a: PGlyphVisAttr): guint = 
  result = (a.flag0 and bm_TPangoGlyphVisAttr_is_cluster_start) shr
      bp_TPangoGlyphVisAttr_is_cluster_start

proc set_is_cluster_start*(a: PGlyphVisAttr, `is_cluster_start`: guint) = 
  a.flag0 = a.flag0 or
      (int16(`is_cluster_start` shl bp_TPangoGlyphVisAttr_is_cluster_start) and
      bm_TPangoGlyphVisAttr_is_cluster_start)

proc TYPE_GLYPH_STRING*(): GType = 
  result = glyph_string_get_type()

proc TYPE_LAYOUT*(): GType = 
  result = layout_get_type()

proc LAYOUT*(anObject: pointer): PLayout = 
  result = cast[PLayout](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_LAYOUT()))

proc LAYOUT_CLASS*(klass: pointer): PLayoutClass = 
  result = cast[PLayoutClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_LAYOUT()))

proc IS_LAYOUT*(anObject: pointer): bool = 
  result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_LAYOUT())

proc IS_LAYOUT_CLASS*(klass: pointer): bool = 
  result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_LAYOUT())

proc GET_CLASS*(obj: PLayout): PLayoutClass = 
  result = cast[PLayoutClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_LAYOUT()))

proc TYPE_TAB_ARRAY*(): GType = 
  result = tab_array_get_type()