summaryrefslogtreecommitdiff
path: root/fpcsrc/packages/univint/src/ATSUnicodeDrawing.pas
blob: 922a1325090c65876b86595bd8c9f146f5471b9d (plain)
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
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
{
     File:       QD/ATSUnicodeDrawing.h
 
     Contains:   ATSUI drawing, measuring, and highlighting functions.
 
     Version:    Quickdraw-262~1
 
     Copyright:  © 2003-2008 by Apple Inc. all rights reserved.
 
     Bugs?:      For bug reports, consult the following page on
                 the World Wide Web:
 
                     http://www.freepascal.org/bugs.html
 
}
{	  Pascal Translation:  Peter N Lewis, <peter@stairways.com.au>, 2004 }
{   Pascal Translation Updated:  Jonas Maebe, <jonas@freepascal.org>, October 2009 }
{
    Modified for use with Free Pascal
    Version 308
    Please report any bugs to <gpc@microbizz.nl>
}

{$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
{$mode macpas}
{$packenum 1}
{$macro on}
{$inline on}
{$calling mwpascal}

unit ATSUnicodeDrawing;
interface
{$setc UNIVERSAL_INTERFACES_VERSION := $0400}
{$setc GAP_INTERFACES_VERSION := $0308}

{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
{$endc}

{$ifc defined CPUPOWERPC and defined CPUI386}
	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
{$endc}
{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
{$endc}

{$ifc not defined __ppc__ and defined CPUPOWERPC32}
	{$setc __ppc__ := 1}
{$elsec}
	{$setc __ppc__ := 0}
{$endc}
{$ifc not defined __ppc64__ and defined CPUPOWERPC64}
	{$setc __ppc64__ := 1}
{$elsec}
	{$setc __ppc64__ := 0}
{$endc}
{$ifc not defined __i386__ and defined CPUI386}
	{$setc __i386__ := 1}
{$elsec}
	{$setc __i386__ := 0}
{$endc}
{$ifc not defined __x86_64__ and defined CPUX86_64}
	{$setc __x86_64__ := 1}
{$elsec}
	{$setc __x86_64__ := 0}
{$endc}
{$ifc not defined __arm__ and defined CPUARM}
	{$setc __arm__ := 1}
{$elsec}
	{$setc __arm__ := 0}
{$endc}

{$ifc defined cpu64}
  {$setc __LP64__ := 1}
{$elsec}
  {$setc __LP64__ := 0}
{$endc}


{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
	{$error Conflicting definitions for __ppc__ and __i386__}
{$endc}

{$ifc defined __ppc__ and __ppc__}
	{$setc TARGET_CPU_PPC := TRUE}
	{$setc TARGET_CPU_PPC64 := FALSE}
	{$setc TARGET_CPU_X86 := FALSE}
	{$setc TARGET_CPU_X86_64 := FALSE}
	{$setc TARGET_CPU_ARM := FALSE}
	{$setc TARGET_OS_MAC := TRUE}
	{$setc TARGET_OS_IPHONE := FALSE}
	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
{$elifc defined __ppc64__ and __ppc64__}
	{$setc TARGET_CPU_PPC := FALSE}
	{$setc TARGET_CPU_PPC64 := TRUE}
	{$setc TARGET_CPU_X86 := FALSE}
	{$setc TARGET_CPU_X86_64 := FALSE}
	{$setc TARGET_CPU_ARM := FALSE}
	{$setc TARGET_OS_MAC := TRUE}
	{$setc TARGET_OS_IPHONE := FALSE}
	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
{$elifc defined __i386__ and __i386__}
	{$setc TARGET_CPU_PPC := FALSE}
	{$setc TARGET_CPU_PPC64 := FALSE}
	{$setc TARGET_CPU_X86 := TRUE}
	{$setc TARGET_CPU_X86_64 := FALSE}
	{$setc TARGET_CPU_ARM := FALSE}
{$ifc defined(iphonesim)}
 	{$setc TARGET_OS_MAC := FALSE}
	{$setc TARGET_OS_IPHONE := TRUE}
	{$setc TARGET_IPHONE_SIMULATOR := TRUE}
{$elsec}
	{$setc TARGET_OS_MAC := TRUE}
	{$setc TARGET_OS_IPHONE := FALSE}
	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
{$endc}
{$elifc defined __x86_64__ and __x86_64__}
	{$setc TARGET_CPU_PPC := FALSE}
	{$setc TARGET_CPU_PPC64 := FALSE}
	{$setc TARGET_CPU_X86 := FALSE}
	{$setc TARGET_CPU_X86_64 := TRUE}
	{$setc TARGET_CPU_ARM := FALSE}
	{$setc TARGET_OS_MAC := TRUE}
	{$setc TARGET_OS_IPHONE := FALSE}
	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
{$elifc defined __arm__ and __arm__}
	{$setc TARGET_CPU_PPC := FALSE}
	{$setc TARGET_CPU_PPC64 := FALSE}
	{$setc TARGET_CPU_X86 := FALSE}
	{$setc TARGET_CPU_X86_64 := FALSE}
	{$setc TARGET_CPU_ARM := TRUE}
	{ will require compiler define when/if other Apple devices with ARM cpus ship }
	{$setc TARGET_OS_MAC := FALSE}
	{$setc TARGET_OS_IPHONE := TRUE}
	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
{$elsec}
	{$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ is defined.}
{$endc}

{$ifc defined __LP64__ and __LP64__ }
  {$setc TARGET_CPU_64 := TRUE}
{$elsec}
  {$setc TARGET_CPU_64 := FALSE}
{$endc}

{$ifc defined FPC_BIG_ENDIAN}
	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
{$elifc defined FPC_LITTLE_ENDIAN}
	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
{$elsec}
	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
{$endc}
{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
{$setc CALL_NOT_IN_CARBON := FALSE}
{$setc OLDROUTINENAMES := FALSE}
{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
{$setc OPAQUE_UPP_TYPES := TRUE}
{$setc OTCARBONAPPLICATION := TRUE}
{$setc OTKERNEL := FALSE}
{$setc PM_USE_SESSION_APIS := TRUE}
{$setc TARGET_API_MAC_CARBON := TRUE}
{$setc TARGET_API_MAC_OS8 := FALSE}
{$setc TARGET_API_MAC_OSX := TRUE}
{$setc TARGET_CARBON := TRUE}
{$setc TARGET_CPU_68K := FALSE}
{$setc TARGET_CPU_MIPS := FALSE}
{$setc TARGET_CPU_SPARC := FALSE}
{$setc TARGET_OS_UNIX := FALSE}
{$setc TARGET_OS_WIN32 := FALSE}
{$setc TARGET_RT_MAC_68881 := FALSE}
{$setc TARGET_RT_MAC_CFM := FALSE}
{$setc TARGET_RT_MAC_MACHO := TRUE}
{$setc TYPED_FUNCTION_POINTERS := TRUE}
{$setc TYPE_BOOL := FALSE}
{$setc TYPE_EXTENDED := FALSE}
{$setc TYPE_LONGLONG := TRUE}
uses MacTypes,TextCommon,QuickdrawTypes,ATSLayoutTypes,ATSUnicodeTypes;
{$endc} {not MACOSALLINCLUDE}


{$ifc TARGET_OS_MAC}

{$ALIGN POWER}


{ ---------------------------------------------------------------------------- }
{  ATSUI drawing and measuring                                                 }
{ ---------------------------------------------------------------------------- }


{
 *  ATSUDrawText()   *** DEPRECATED ***
 *  
 *  Deprecated:
 *    Use CTFrameDraw, CTLiineDraw, or CTRunDraw instead.
 *  
 *  Summary:
 *    Draws a specified range of text in a QuickDraw graphics port or
 *    Quartz graphics context.
 *  
 *  Discussion:
 *    Before calling ATSUDrawText, you will most likely want to call
 *    ATSUSetLayoutControls to set a value for the kATSUCGContextTag
 *    attribute in order to specify your current graphics context.
 *    Otherwise, ATSUI will attempt to draw using Quickdraw style text
 *    rendering in whatever Quickdraw GrafPort is currently active (use
 *    SetPort to determine the currently active Quickdraw GrafPort, see
 *    Quickdraw.h). Carbon applications can create a CGContext from a
 *    Quickdraw GrafPort using the functions QDBeginCGContext and
 *    QDEndCGContext (see Quickdraw.h). Cocoa applications can call the
 *    method "graphicsPort" on the current NSGraphicsContext in order
 *    to get a CGContextRef to pass into ATSUI (use the method
 *    "currentContext" to obtain the current NSGraphicsContext, see
 *    NSGraphicsContext.h for more information). ATSUDrawText examines
 *    the text layout object to ensure that each of the characters in
 *    the range is assigned to a style run. If there are gaps between
 *    style runs, ATSUI assigns the characters in the gap to the style
 *    run that precedes (in storage order) the gap. If there is no
 *    style run at the beginning of the text range, ATSUI assigns these
 *    characters to the first style run it finds. If there is no style
 *    run at the end of the text range, ATSUI assigns the remaining
 *    characters to the last style run it finds. If you want to draw a
 *    range of text that spans multiple lines, you should call
 *    ATSUDrawText for each line of text to draw, even if all the lines
 *    are in the same text layout object. You should adjust the
 *    iLineOffset parameter to reflect the beginning of each line to be
 *    drawn. Please note that when drawing into a GrafPort, calls to
 *    QDSwapTextFlags have no effect on ATSUI text rendering. The
 *    proper way to achieve Quartz text rendering from ATSUI is to use
 *    the kATSUCGContextTag attribute to specify a CGContextRef in each
 *    ATSUTextLayout before calling ATSUDrawText.
 *  
 *  Parameters:
 *    
 *    iTextLayout:
 *      A layout containing text to draw.
 *    
 *    iLineOffset:
 *      The starting offset of the range of text to draw. To specify
 *      the beginning of the text buffer, pass kATSUFromTextBeginning
 *      for this parameter.
 *    
 *    iLineLength:
 *      The length of the range of text to draw. To specify a range
 *      that continues to the end of the text buffer, pass
 *      kATSUToTextEnd for this parameter.
 *    
 *    iLocationX:
 *      The x-coordinate of the origin (in either the current graphics
 *      port or Quartz graphics context) of the line containing the
 *      text range to render. Note that the ATSUTextMeasurement type is
 *      defined as a Fixed value, so you must ensure that your
 *      coordinates are converted to Fixed values before passing them
 *      to this function (see FixMath.h for conversion functions). Pass
 *      the constant kATSUUseGrafPortPenLoc to draw relative to the
 *      current pen location in the current graphics port.
 *    
 *    iLocationY:
 *      The y-coordinate of the origin (in either the current graphics
 *      port or Quartz graphics context) of the line containing the
 *      text range to render. Note that the ATSUTextMeasurement type is
 *      defined as a Fixed value, so you must ensure that your
 *      coordinates are converted to Fixed values before passing them
 *      to this function (see FixMath.h for conversion functions). Pass
 *      the constant kATSUUseGrafPortPenLoc to draw relative to the
 *      current pen location in the current graphics port.
 *  
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework but deprecated in 10.6
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
function ATSUDrawText( iTextLayout: ATSUTextLayout; iLineOffset: UniCharArrayOffset; iLineLength: UniCharCount; iLocationX: ATSUTextMeasurement; iLocationY: ATSUTextMeasurement ): OSStatus; external name '_ATSUDrawText';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)


{$ifc not TARGET_CPU_64}
{
 *  ATSUGetUnjustifiedBounds()   *** DEPRECATED ***
 *  
 *  Deprecated:
 *    Use CTLineGetTypographicBounds or
 *    CTLineGetTrailingWhitespaceWidth instead.
 *  
 *  Summary:
 *    Obtains the typographic bounding rectangle for a line of text
 *    prior to final layout.
 *  
 *  Discussion:
 *    This function calculates the typographic bounds (in coordinates
 *    independent of the rendering device) for a line of text. Note
 *    that ATSUGetUnjustifiedBounds calculates these bounds prior to
 *    the text's final layout, and therefore, the calculated bounds
 *    might not reflect those of the final laid-out line.
 *    Justification, truncation, and device level positioning are not
 *    taken into account. To obtain the typographic bounds of a line
 *    after it is laid out, you can call the function
 *    ATSUGetGlyphBounds. For more infomration about the difference
 *    between typographic and image bounds, please refer to the ATSUI
 *    documentation. Note that ATSUGetUnjustifiedBounds treats the
 *    specified text range as a single line. That is, if the range of
 *    text you specify is less than a line, it nevertheless treats the
 *    initial character in the range as the start of a line, for
 *    measuring purposes. If the range of text extends beyond a line,
 *    ATSUGetUnjustifiedBounds ignores soft line breaks, again,
 *    treating the text as a single line.
 *  
 *  Parameters:
 *    
 *    iTextLayout:
 *      The text layout object to obtain bounds information for.
 *    
 *    iLineStart:
 *      The start of the line of text to obtain bounds information for.
 *      To indicate that the line starts at the beginning of the text
 *      buffer, you can pass the constant kATSUFromTextBeginning . To
 *      specify the entire text buffer, pass kATSUFromTextBeginning in
 *      this parameter and kATSUToTextEnd in the iLineLength parameter.
 *    
 *    iLineLength:
 *      The length of the line to obtain bounds information for. If you
 *      want the line to extend to the end of the text buffer, you can
 *      pass the constant kATSUToTextEnd .
 *    
 *    oTextBefore:
 *      On return, the value specifies the starting point of the
 *      typographic bounds for the line, relative to the origin (0,0)
 *      of the line and taking into account cross-stream shifting. Note
 *      that the ATSUMeasureText function might produce negative values
 *      for the typographic starting point of the line if, for example,
 *      the initial character of the line is allowed to hang into the
 *      margin. For horizontal text, this value corresponds to the left
 *      side of the bounding rectangle.
 *    
 *    oTextAfter:
 *      On return, the end point of the typographic bounds for the
 *      line, relative to the origin (0,0) of the line and taking into
 *      account cross-stream shifting. For horizontal text, this value
 *      corresponds to the right side of the bounding rectangle.
 *    
 *    oAscent:
 *      On return, the typographic bounds for the line, relative to the
 *      origin (0,0) of the line and taking into account cross-stream
 *      shifting. For horizontal text, this value corresponds to the
 *      top side of the bounding rectangle.
 *    
 *    oDescent:
 *      On return, the typographic bounds for the line, relative to the
 *      origin (0,0) of the line and taking into account cross-stream
 *      shifting. For horizontal text, this value corresponds to the
 *      bottom side of the bounding rectangle.
 *  
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *  
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework [32-bit only] but deprecated in 10.6
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
function ATSUGetUnjustifiedBounds( iTextLayout: ATSUTextLayout; iLineStart: UniCharArrayOffset; iLineLength: UniCharCount; var oTextBefore: ATSUTextMeasurement; var oTextAfter: ATSUTextMeasurement; var oAscent: ATSUTextMeasurement; var oDescent: ATSUTextMeasurement ): OSStatus; external name '_ATSUGetUnjustifiedBounds';
(* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)


{
 *  ATSUMeasureTextImage()   *** DEPRECATED ***
 *  
 *  Deprecated:
 *    Use CTLineGetImageBounds or CTRunGetImageBounds instead.
 *  
 *  Summary:
 *    Obtains the image bounding rectangle for a line of text after
 *    final layout.
 *  
 *  Discussion:
 *    This function obtains the image bounds of a laid-out line of
 *    text. These bounds are described by the smallest rectangle that
 *    completely encloses the filled or framed parts of a block of
 *    textÑthat is, the text's "inked" glyphs. In measuring the line,
 *    the ATSUMeasureTextImage function takes into account line
 *    rotation, alignment, and justification, as well as other
 *    characteristics that affect layout, such as hanging punctuation.
 *    (If the line is rotated, the sides of the rectangle are parallel
 *    to the coordinate axes and encompass the rotated line.) If no
 *    attributes are set for the line, ATSUMeasureTextImage uses the
 *    global attributes set for the text layout object. Because the
 *    height of the image bounding rectangle is determined by the
 *    actual device metrics, ATSUMeasureTextImage ignores any
 *    previously set line ascent and descent values for the line it is
 *    measuring.
 *  
 *  Parameters:
 *    
 *    iTextLayout:
 *      The text layout for which to obtain image bounds.
 *    
 *    iLineOffset:
 *      The first character of the line to examine. To indicate that
 *      the specified line starts at the beginning of the text buffer,
 *      you can pass the constant kATSUFromTextBeginning . To specify
 *      the entire text buffer, pass kATSUFromTextBeginning in this
 *      parameter and kATSUToTextEnd in the iLineLength parameter.
 *    
 *    iLineLength:
 *      The length of the text range. If you want the range of text to
 *      extend to the end of the text buffer, you can pass the constant
 *      kATSUToTextEnd . However, the image bounds is restricted to the
 *      line in which iLineOffset resides.
 *    
 *    iLocationX:
 *      The x-coordinate of the line's origin in the current graphics
 *      port or Quartz graphics context. Pass the constant
 *      kATSUUseGrafPortPenLoc for the dimensions of the bounds
 *      relative to the current pen location in the current graphics
 *      port or graphics context. You can pass 0to obtain only the
 *      dimensions of the bounding rectangle relative to one another,
 *      not their actual onscreen position.
 *    
 *    iLocationY:
 *      The y-coordinate of the line's origin in the current graphics
 *      port or Quartz graphics context. Pass the constant
 *      kATSUUseGrafPortPenLoc for the dimensions of the bounds
 *      relative to the current pen location in the current graphics
 *      port or graphics context. You can pass 0to obtain only the
 *      dimensions of the bounding rectangle relative to one another,
 *      not their actual onscreen position.
 *    
 *    oTextImageRect:
 *      On return, the dimensions of the image bounding rectangle for
 *      the text, offset by the values specified in the iLocationX and
 *      iLocationY parameters. If the line is rotated, the sides of the
 *      rectangle are parallel to the coordinate axis.
 *  
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework [32-bit only] but deprecated in 10.6
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
function ATSUMeasureTextImage( iTextLayout: ATSUTextLayout; iLineOffset: UniCharArrayOffset; iLineLength: UniCharCount; iLocationX: ATSUTextMeasurement; iLocationY: ATSUTextMeasurement; var oTextImageRect: Rect ): OSStatus; external name '_ATSUMeasureTextImage';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)


{$endc} {not TARGET_CPU_64}

{
 *  ATSUGetGlyphBounds()   *** DEPRECATED ***
 *  
 *  Deprecated:
 *    Use CTRunGetTypographicBounds, CTLineGetTypographicBounds,
 *    CTFontGetAscent, CTFontGetDescent, CTFontGetLeading, or
 *    CTFontGetUnitsPerEm instead.
 *  
 *  Summary:
 *    Obtains the typographic bounds of a line of glyphs after final
 *    layout.
 *  
 *  Discussion:
 *    This function produces the enclosing trapezoid(s) that represent
 *    the typographic bounds for glyphs in a final, laid-out range of
 *    text. You typically call this function when you need to obtain an
 *    enclosing trapezoid for a line, taking rotation and all other
 *    layout attributes into account. ATSUI determines the height of
 *    each trapezoid by examining any line ascent and descent attribute
 *    values you may have set for the line. If you have not set these
 *    attributes for the line, the ATSUGetGlyphBounds function uses any
 *    line ascent and descent values you may have set for the text
 *    layout object containing the line. If these are not set,
 *    ATSUGetGlyphBounds uses the font's natural line ascent and
 *    descent values for the line. If these are previously set,
 *    ATSUGetGlyphBounds uses the ATSUStyle ascent and or
 *    descent/leading values. Note that the coordinates produced for
 *    the trapezoid(s) are offset by the amount specified in the
 *    iTextBasePointX and iTextBasePointY parameters. If your goal in
 *    calling the ATSUGetGlyphBounds function is to obtain metrics for
 *    drawing the typographic bounds on the screen, pass the position
 *    of the origin of the line in the current graphics port or
 *    graphics context in these parameters. This enables
 *    ATSUGetGlyphBounds to match the trapezoids to their onscreen
 *    image. When the range specified by the iBoundsCharStart and
 *    iBoundsCharLength parameters covers an entire line, you are
 *    guaranteed to receive only one trapezoid on return. Otherwise,
 *    multiple trapezoids may be returned to cover incomplete sections
 *    of bidi runs. In such cases, you would typically call
 *    ATSUGetGlyphBounds twice, as follows: (1) Pass NULL for the
 *    oGlyphBounds parameter, 0 for the iMaxNumberOfBounds parameter,
 *    and valid values for the other parameters. The ATSUGetGlyphBounds
 *    function returns the actual number of trapezoids needed to
 *    enclose the glyphs in the oActualNumberOfBounds parameter. (2)
 *    Allocate enough space for a buffer of the returned size, then
 *    call the function again, passing a valid pointer to the buffer in
 *    the oGlyphBounds parameter. On return, the buffer contains the
 *    trapezoids for the glyphs' typographic bounds. To obtain the
 *    typographic bounds of a line of text prior to line layout, call
 *    the function ATSUGetUnjustifiedBounds. To calculate the image
 *    bounding rectangle for a final laid-out line, call the function
 *    ATSUMeasureTextImage. For more infomration about the difference
 *    between typographic and image bounds, please refer to the ATSUI
 *    documentation.
 *  
 *  Parameters:
 *    
 *    iTextLayout:
 *      The text layout object for which glyph bounds are to be
 *      obtained.
 *    
 *    iTextBasePointX:
 *      The x-coordinate of the origin of the line containing the
 *      glyphs in the current graphics port or Quartz graphics context.
 *      Pass the constant kATSUUseGrafPortPenLoc to obtain the glyph
 *      bounds relative to the current pen location in the current
 *      graphics port or graphics context. You may pass 0 to obtain
 *      only the dimensions of the bounds relative to one another, not
 *      their actual onscreen position.
 *    
 *    iTextBasePointY:
 *      The y-coordinate of the origin of the line containing the
 *      glyphs in the current graphics port or Quartz graphics context.
 *      Pass the constant kATSUUseGrafPortPenLoc to obtain the glyph
 *      bounds relative to the current pen location in the current
 *      graphics port or graphics context. You may pass 0 to obtain
 *      only the dimensions of the bounds relative to one another, not
 *      their actual onscreen position.
 *    
 *    iBoundsCharStart:
 *      The offset from the beginning of the text buffer to the
 *      character corresponding to the first glyph to measure. To
 *      indicate that the text range starts at the beginning of the
 *      text buffer, you can pass the constant kATSUFromTextBeginning.
 *    
 *    iBoundsCharLength:
 *      The length of text range to measure. If you want the range to
 *      extend to the end of the text buffer, you can pass the constant
 *      kATSUToTextEnd.
 *    
 *    iTypeOfBounds:
 *      The type of bounds you wish to obtain. See ATSLayoutTypes.h for
 *      a list of possible values to pass in here.
 *    
 *    iMaxNumberOfBounds:
 *      The maximum number of bounding trapezoids to obtain. Typically,
 *      this is equivalent to the number of bounds in the oGlyphBounds
 *      array. To determine this value, see the Discussion.
 *    
 *    oGlyphBounds:
 *      A pointer to memory you have allocated for an array of
 *      ATSTrapezoid values. On return, the array contains a trapezoid
 *      representing the typographic bounds for glyphs in the text
 *      range. If the specified range of text encloses nested
 *      bidirectional text, ATSUGetGlyphBounds produces multiple
 *      trapezoids defining these regions.In ATSUI 1.1, the maximum
 *      number of enclosing trapezoids that can be returned is 31; in
 *      ATSUI 1.2, the maximum number is 127. If you pass a range that
 *      covers an entire line, ATSUGetGlyphBounds always returns only 1
 *      trapezoid. If you are uncertain of how much memory to allocate
 *      for this array, see the Discussion.
 *    
 *    oActualNumberOfBounds:
 *      On return, the value specifies the actual number of enclosing
 *      trapezoids bounding the specified characters. This may be
 *      greater than the value you provide in the iMaxNumberOfBounds
 *      parameter.
 *  
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework but deprecated in 10.6
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
 }
function ATSUGetGlyphBounds( iTextLayout: ATSUTextLayout; iTextBasePointX: ATSUTextMeasurement; iTextBasePointY: ATSUTextMeasurement; iBoundsCharStart: UniCharArrayOffset; iBoundsCharLength: UniCharCount; iTypeOfBounds: UInt16; iMaxNumberOfBounds: ItemCount; oGlyphBounds: {variable-size-array} ATSTrapezoidPtr { can be NULL }; var oActualNumberOfBounds: ItemCount  ): OSStatus; external name '_ATSUGetGlyphBounds';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)


{ ---------------------------------------------------------------------------- }
{  ATSUI line breaking                                                         }
{ ---------------------------------------------------------------------------- }
{$ifc not TARGET_CPU_64}
{
 *  ATSUBatchBreakLines()   *** DEPRECATED ***
 *  
 *  Deprecated:
 *    Use CTTypesetterSuggestLineBreak,
 *    CTTypesetterSuggestClusterBreak, or CTTypesetterCreateLine
 *    instead.
 *  
 *  Summary:
 *    Soft wraps a range of text in a layout to a constant line width.
 *  
 *  Discussion:
 *    Equivalent to repeatedly calling the ATSUBreakLine function with
 *    the parameter iUseAsSoftLineBreak set to true. Use this function
 *    to gain a substantial performance increase over the use of
 *    ATSUBreakLine. It will set soft breaks in a layout for multiple
 *    lines in a single call. It assumes constant line width. Soft line
 *    breaks within a layout are what divide it into lines. You can
 *    manipulate the soft breaks that are currently set within a layout
 *    using the functions ATSUGetSoftLineBreaks, ATSUSetSoftLineBreak,
 *    and ATSUClearSoftLineBreaks.
 *  
 *  Parameters:
 *    
 *    iTextLayout:
 *      The layout containing text to be soft wrapped.
 *    
 *    iRangeStart:
 *      Beginning offset for the rage of text to be soft wrapped.
 *    
 *    iRangeLength:
 *      The length of the range of text to be soft wrapped.
 *    
 *    iLineWidth:
 *      The line width at which to force soft wrapping of text. Note
 *      that this parameter is of type ATSUTextMeasurement, which is
 *      defined as Fixed. See FixMath.h for conversion routines for
 *      fixed point values.
 *    
 *    oBreakCount:
 *      On return, the number of soft breaks that were set in the
 *      layout. Use this to determine how much memory to allocate when
 *      calling ATSUGetSoftLineBreaks.
 *  
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *  
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework [32-bit only] but deprecated in 10.6
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
function ATSUBatchBreakLines( iTextLayout: ATSUTextLayout; iRangeStart: UniCharArrayOffset; iRangeLength: UniCharCount; iLineWidth: ATSUTextMeasurement; oBreakCount: ItemCountPtr { can be NULL } ): OSStatus; external name '_ATSUBatchBreakLines';
(* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)


{
 *  ATSUBreakLine()   *** DEPRECATED ***
 *  
 *  Deprecated:
 *    Use CTTypesetterSuggestLineBreak,
 *    CTTypesetterSuggestClusterBreak, or CTTypesetterCreateLine
 *    instead.
 *  
 *  Summary:
 *    Soft wraps a single line of text within a layout.
 *  
 *  Discussion:
 *    This function will automatically determine the optimal place to
 *    set a soft break in a given range of text. It suggests a soft
 *    line break each time it encounters a hard line break character
 *    such as a carriage return, line feed, form feed, line separator,
 *    or paragraph separator. If ATSUBreakLine does not encounter a
 *    hard line break, it uses the line width you specify to determine
 *    how many characters fit on a line and suggests soft line breaks
 *    accordingly. You can loop over ATSUBreakLine, repeatedly calling
 *    it on the same layout, until all the text in the entire layout
 *    has been soft wrapped. However, for maximum efficiency, you
 *    should use ATSUBatchBreakLines. ATSUBreakLine should only be used
 *    if you have special needs, such as a non-constant line width.
 *  
 *  Parameters:
 *    
 *    iTextLayout:
 *      The layout containing text to be soft wrapped.
 *    
 *    iLineStart:
 *      The beginning of the line you wish to soft wrap. To specify the
 *      beginning of the text buffer, pass the constant
 *      kATSUFromTextBeginning.
 *    
 *    iLineWidth:
 *      The line width at which to force soft wrapping of text. Note
 *      that this parameter is of type ATSUTextMeasurement, which is
 *      defined as Fixed. See FixMath.h for conversion routines for
 *      fixed point values.
 *    
 *    iUseAsSoftLineBreak:
 *      A Boolean value indicating whether ATSUBreakLine should
 *      automatically set the line break produced in the oLineBreak
 *      parameter. If true ,ATSUBreakLine sets the line break and
 *      clears any previously-set soft line breaks that precede the new
 *      break in the line but lie after the offset specified by
 *      iLineStart. You should ususally pass true for this parameter,
 *      unless you plan to use ATSUSetSoftLineBreak to set the soft
 *      break somewhere other than what is suggested by ATSUBreakLine.
 *    
 *    oLineBreak:
 *      On return, the value specifies the soft line break as
 *      determined by ATSUBreakLine. If the value returned is the same
 *      value as specified in iLineStart , you have made an input
 *      parameter error. In this case, check to make sure that the line
 *      width specified in iLineWidth is big enough for ATSUBreakLine
 *      to perform line breaking. ATSUBreakLine does not return an
 *      error in this case.
 *  
 *  Result:
 *    On success, noErr is returned. TSUI usually calculates a soft
 *    line break to be at the beginning of the first word that does ont
 *    fit on the line. But if ATSUBreakLine calculates the most optimal
 *    line break to be in the middle of a word, it returns the result
 *    code kATSULineBreakInWord. Note that ATSUI produces a line break
 *    in the middle of a word only as a last resort. See MacErrors.h
 *    for other possible error codes.
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework [32-bit only] but deprecated in 10.6
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
function ATSUBreakLine( iTextLayout: ATSUTextLayout; iLineStart: UniCharArrayOffset; iLineWidth: ATSUTextMeasurement; iUseAsSoftLineBreak: Boolean; oLineBreak: UniCharArrayOffsetPtr { can be NULL } ): OSStatus; external name '_ATSUBreakLine';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)


{
 *  ATSUSetSoftLineBreak()   *** DEPRECATED ***
 *  
 *  Deprecated:
 *    Use CTTypesetterSuggestLineBreak,
 *    CTTypesetterSuggestClusterBreak, or CTTypesetterCreateLine
 *    instead.
 *  
 *  Summary:
 *    Sets a soft line break at the specified point in a text layout.
 *  
 *  Discussion:
 *    You should typically only call ATSUSetSoftLineBreak to set line
 *    breaks when you are using your own line-breaking algorithm to
 *    calculate these breaks. For optimal performance, you should use
 *    ATSUBatchBreakLines to both calculate and set soft line breaks in
 *    your text. After calling ATSUSetSoftLineBreak , you should call
 *    the function ATSUGetUnjustifiedBounds to determine whether the
 *    characters still fit within the line, which is necessary due to
 *    end-of-line effects such as swashes.
 *  
 *  Parameters:
 *    
 *    iTextLayout:
 *      The layout in which to set the soft break.
 *    
 *    iLineBreak:
 *      An offset into the text buffer specifying the location to set
 *      the soft break at.
 *  
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework [32-bit only] but deprecated in 10.6
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
function ATSUSetSoftLineBreak( iTextLayout: ATSUTextLayout; iLineBreak: UniCharArrayOffset ): OSStatus; external name '_ATSUSetSoftLineBreak';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)


{
 *  ATSUGetSoftLineBreaks()   *** DEPRECATED ***
 *  
 *  Deprecated:
 *    Use CTTypesetterSuggestLineBreak,
 *    CTTypesetterSuggestClusterBreak, or CTTypesetterCreateLine
 *    instead.
 *  
 *  Summary:
 *    Obtains the soft line breaks that are currently set in a given
 *    text range.
 *  
 *  Discussion:
 *    Typically you use the function ATSUGetSoftLineBreaks by calling
 *    it twice, as follows: (1) Pass valid values for the iTextLayout,
 *    iRangeStart, iRangeLength, and oBreakCount parameters. Pass NULL
 *    for the oBreaks parameter and 0 for the iMaximumBreaks parameter.
 *    ATSUGetSoftLineBreaks returns the size of the font array in the
 *    oBreakCount parameter. (2) Allocate enough space for an array of
 *    the returned size, then call the function again, passing a valid
 *    pointer in the oBreaks parameter. On return, the pointer refers
 *    to an array containing the text range's soft line breaks. If you
 *    have just called ATSUBatchBreakLines, the oBreakCount parameter
 *    will give you the value you would normally obtain from step 1,
 *    allowing you to skip this step in such cases.
 *  
 *  Parameters:
 *    
 *    iTextLayout:
 *      A text layout to obtain a list of soft breaks from.
 *    
 *    iRangeStart:
 *      The beginning of the range of text for which to obtain a list
 *      of softbreaks. To indicate that the specified text range starts
 *      at the beginning of the text buffer, you can pass the constant
 *      kATSUFromTextBeginning, To specify the entire text buffer, pass
 *      kATSUFromTextBeginning in this parameter and kATSUToTextEnd in
 *      the iRangeLength parameter.
 *    
 *    iRangeLength:
 *      The end of the range of text for which to obtain a list of
 *      softbreaks. If you want the range of text to extend to the end
 *      of the text buffer, you can pass the constant kATSUToTextEnd.
 *    
 *    iMaximumBreaks:
 *      The maximum number of soft line breaks to obtain. Typically,
 *      this is equivalent to the number of UniCharArrayOffset values
 *      for which you have allocated memory in the oBreaks array. To
 *      determine this value, see the Discussion.
 *    
 *    oBreaks:
 *      On return, the array contains offsets from the beginning of the
 *      text buffer to each of the soft line breaks in the text range.
 *      If you are uncertain of how much memory to allocate for this
 *      array, see the Discussion.
 *    
 *    oBreakCount:
 *      On return, the number of soft breaks set in iTextLayout. Note
 *      that this value may be greater than what you pass in for
 *      iMaximumBreaks.
 *  
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework [32-bit only] but deprecated in 10.6
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
function ATSUGetSoftLineBreaks( iTextLayout: ATSUTextLayout; iRangeStart: UniCharArrayOffset; iRangeLength: UniCharCount; iMaximumBreaks: ItemCount; oBreaks: {variable-size-array} UniCharArrayOffsetPtr { can be NULL }; oBreakCount: ItemCountPtr { can be NULL } ): OSStatus; external name '_ATSUGetSoftLineBreaks';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)


{
 *  ATSUClearSoftLineBreaks()   *** DEPRECATED ***
 *  
 *  Deprecated:
 *    Use CTTypesetterSuggestLineBreak,
 *    CTTypesetterSuggestClusterBreak, or CTTypesetterCreateLine
 *    instead.
 *  
 *  Summary:
 *    Unsets any currently set soft breaks in a range of text.
 *  
 *  Discussion:
 *    This function clears all previously set soft line breaks for the
 *    specified text range and clears any associated layout caches as
 *    well.
 *  
 *  Parameters:
 *    
 *    iTextLayout:
 *      The text layout object for which to remove line breaks.
 *    
 *    iRangeStart:
 *      The beginning of the text range over which to clear soft line
 *      breaks. To indicate that the specified text range starts at the
 *      beginning of the text buffer, you can pass the constant
 *      kATSUFromTextBeginning . To specify the entire text buffer,
 *      pass kATSUFromTextBeginning in this parameter and
 *      kATSUToTextEnd in the iRangeLength parameter.
 *    
 *    iRangeLength:
 *      The length of the text range over which to clear soft line
 *      breaks. If you want the range of text to extend to the end of
 *      the text buffer, you can pass the constant kATSUToTextEnd.
 *  
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework [32-bit only] but deprecated in 10.6
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
function ATSUClearSoftLineBreaks( iTextLayout: ATSUTextLayout; iRangeStart: UniCharArrayOffset; iRangeLength: UniCharCount ): OSStatus; external name '_ATSUClearSoftLineBreaks';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)


{ ---------------------------------------------------------------------------- }
{  ATSUI highlighting                                                          }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUSetHighlightingMethod()   *** DEPRECATED ***
 *  
 *  Deprecated:
 *    Use CTLineGetOffsetForStringIndex,
 *    CTLineGetStringIndexForPosition instead.
 *  
 *  Summary:
 *    Specifies the methods ATSUI will use for highlighting and
 *    unhighlighting text in a given layout.
 *  
 *  Discussion:
 *    By default, ATSUI highlights text by "inverting" the region
 *    containing the text, that is, its background color. Although
 *    inversion provides satisfactory highlighting in most cases, it
 *    does not always provide the best result for grayscale text. (Mac
 *    OS X sets a lower threshold for antialiasing, while in Mac OS 9
 *    grayscale text can be turned off by the user.) In Mac OS X, when
 *    using a Quartz graphics context, you can instruct ATSUI to use
 *    the redraw method of highlighting, rather than simple inversion.
 *    (Note that Cocoa applications always use the redraw method of
 *    highlighting.) The redraw method allows for accurate highlighting
 *    of more complex backgrounds, such as those containing multiple
 *    colors, patterns, or pictures. To set redrawing on, call the
 *    ATSUSetHighlightingMethod function and specify that the redraw
 *    method be used (by passing kRedrawHighlighting in the iMethod
 *    parameter). If you specify the redraw method of highlighting when
 *    you call ATSUSetHighlightingMethod, then you must also specify
 *    how the background is to be redrawn when the function
 *    ATSUUnhighlightText is called. ATSUI can restore the desired
 *    background in one of two ways, depending on the background's
 *    complexity: (1) When the background is a single color (such as
 *    white), ATSUI can readily unhighlight the background. In such a
 *    case, you specify the background color that ATSUI uses by calling
 *    ATSUSetHighlightingMethod and setting iUnhighlightData.dataType
 *    to kATSUBackgroundColor and providing the background color in
 *    iUnhighlightData.unhighlightData. With these settings defined,
 *    when you call ATSUUnhighlightText, ATSUI simply calculates the
 *    previously highlighted area, repaints it with the specified
 *    background color, and then redraws the text. (2) When the
 *    background is more complex (containing, for example, multiple
 *    colors, patterns, or pictures), you must provide a redraw
 *    background callback function when you call
 *    ATSUSetHighlightingMethod. You do this by setting
 *    iUnhighlightData.dataType to kATSUBackgroundCallback and
 *    providing a RedrawBackgroundUPP in
 *    iUnhighlightData.unhighlightData . Then when you call
 *    ATSUUnhighlightText and ATSUI calls your callback, you are
 *    responsible for redrawing the background of the unhighlighted
 *    area. If you choose to also redraw the text, then your callback
 *    should return false as a function result. If your callback
 *    returns true ATSUI redraws any text that needs to be redrawn. See
 *    RedrawBackgroundProcPtr for additional information.
 *  
 *  Parameters:
 *    
 *    iTextLayout:
 *      The layout to which this highlight method should be applied.
 *    
 *    iMethod:
 *      The type of highlighting to use; inversion
 *      (kInvertHighlighting) or redrawing (kRedrawHighlighting). The
 *      default is inversion. If you are happy with that technique
 *      there is no reason to call this function.
 *    
 *    iUnhighlightData:
 *      Data needed to redraw the background or NULL if inversion is
 *      being chosen. See the definition of ATSUUnhighlightData for
 *      more information about the possible contents of this structure.
 *      Also see the Discussion for this function.
 *  
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework [32-bit only] but deprecated in 10.6
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Non-Carbon CFM:   not available
 }
function ATSUSetHighlightingMethod( iTextLayout: ATSUTextLayout; iMethod: ATSUHighlightMethod; {const} iUnhighlightData: ATSUUnhighlightDataPtr { can be NULL } ): OSStatus; external name '_ATSUSetHighlightingMethod';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)


{
 *  ATSUHighlightText()   *** DEPRECATED ***
 *  
 *  Deprecated:
 *    Use CTLineGetOffsetForStringIndex,
 *    CTLineGetStringIndexForPosition instead.
 *  
 *  Summary:
 *    Renders a highlighted range of text at a specified location in a
 *    QuickDraw graphics port or Quartz graphics context.
 *  
 *  Discussion:
 *    When the user selects a series of glyphs, the characters in
 *    memory corresponding to the glyphs make up the selection range
 *    and should be highlighted to indicate where the next editing
 *    operation is to occur. The characters in a selection range are
 *    always contiguous in memory, but their corresponding glyphs are
 *    not necessarily so onscreen. If the selection range crosses a
 *    direction boundary, it is appropriate to display discontinuous
 *    highlighting. The ATSUHighlightText function renders a
 *    highlighted range of text at a specified location in a QuickDraw
 *    graphics port or Quartz graphics context, using the highlight
 *    information in the graphics port or context. ATSUHighlightText
 *    automatically produces discontinuous highlighting, if needed. You
 *    typically call the ATSUHighlightText function every time you need
 *    to draw or redraw highlighted text.
 *  
 *  Parameters:
 *    
 *    iTextLayout:
 *      A layout containing text to be highlighted.
 *    
 *    iTextBasePointX:
 *      The x-coordinate of the origin (in either the current graphics
 *      port or in a Quartz graphics context) of the line containing
 *      the text range. Pass the constant kATSUUseGrafPortPenLoc to
 *      draw relative to the current pen location in the current
 *      graphics port.
 *    
 *    iTextBasePointY:
 *      The y-coordinate of the origin (in either the current graphics
 *      port or in a Quartz graphics context) of the line containing
 *      the text range. Pass the constant kATSUUseGrafPortPenLoc to
 *      draw relative to the current pen location in the current
 *      graphics port.
 *    
 *    iHighlightStart:
 *      The first character of the text range to be highlighted. If the
 *      text range spans multiple lines, you should call
 *      ATSUHighlightText for each line, passing the offset
 *      corresponding to the beginning of the new line to draw with
 *      each call. To indicate that the specified text range starts at
 *      the beginning of the text buffer, you can pass the constant
 *      kATSUFromTextBeginning. To specify the entire text buffer, pass
 *      kATSUFromTextBeginning in this parameter and kATSUToTextEnd in
 *      the iHighlightLength parameter.
 *    
 *    iHighlightLength:
 *      The length of the text range to be highlighted. To indicate
 *      that the text range extends to the end of the text buffer, pass
 *      the constant kATSUToTextEnd.
 *  
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework [32-bit only] but deprecated in 10.6
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
function ATSUHighlightText( iTextLayout: ATSUTextLayout; iTextBasePointX: ATSUTextMeasurement; iTextBasePointY: ATSUTextMeasurement; iHighlightStart: UniCharArrayOffset; iHighlightLength: UniCharCount ): OSStatus; external name '_ATSUHighlightText';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)


{
 *  ATSUUnhighlightText()   *** DEPRECATED ***
 *  
 *  Deprecated:
 *    Use CTLineGetOffsetForStringIndex,
 *    CTLineGetStringIndexForPosition instead.
 *  
 *  Summary:
 *    Renders a previously highlighted range of text in an
 *    unhighlighted state.
 *  
 *  Discussion:
 *    This function renders a previously highlighted range of text in
 *    an unhighlighted state. You should always call
 *    ATSUUnhighlightText after calling the function ATSUHighlightText
 *    to properly redraw the unhighlighted text and background. If the
 *    inversion method of highlighting was used, when you call
 *    ATSUUnhighlightText, it merely undoes the inversion and renders
 *    the text. If the redraw method of highlighting was used,
 *    ATSUUnhighlightText turns off the highlighting and restores the
 *    desired background. Depending on the complexity of the
 *    background, ATSUI restores the background in one of two ways:
 *    filling in a solid color, or repainting the background using a
 *    callback. See the function ATSUSetHighlightingMethod and the
 *    definition ATSUUnhighlightData for more information.
 *  
 *  Parameters:
 *    
 *    iTextLayout:
 *      A layout containing text to be unhighlighted.
 *    
 *    iTextBasePointX:
 *      The x-coordinate of the origin (in either the current graphics
 *      port or in a Quartz graphics context) of the line containing
 *      the text range. Pass the constant kATSUUseGrafPortPenLoc to
 *      draw relative to the current pen location in the current
 *      graphics port.
 *    
 *    iTextBasePointY:
 *      The y-coordinate of the origin (in either the current graphics
 *      port or in a Quartz graphics context) of the line containing
 *      the text range. Pass the constant kATSUUseGrafPortPenLoc to
 *      draw relative to the current pen location in the current
 *      graphics port.
 *    
 *    iHighlightStart:
 *      The first character of the text range to be unhighlighted. If
 *      the text range spans multiple lines, you should call
 *      ATSUUnhighlightText for each line, passing the offset
 *      corresponding to the beginning of the new line to draw with
 *      each call. To indicate that the specified text range starts at
 *      the beginning of the text buffer, you can pass the constant
 *      kATSUFromTextBeginning. To specify the entire text buffer, pass
 *      kATSUFromTextBeginning in this parameter and kATSUToTextEnd in
 *      the iHighlightLength parameter.
 *    
 *    iHighlightLength:
 *      The length of the text range to be unhighlighted. To indicate
 *      that the text range extends to the end of the text buffer, pass
 *      the constant kATSUToTextEnd.
 *  
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework [32-bit only] but deprecated in 10.6
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
function ATSUUnhighlightText( iTextLayout: ATSUTextLayout; iTextBasePointX: ATSUTextMeasurement; iTextBasePointY: ATSUTextMeasurement; iHighlightStart: UniCharArrayOffset; iHighlightLength: UniCharCount ): OSStatus; external name '_ATSUUnhighlightText';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)


{
 *  ATSUGetTextHighlight()   *** DEPRECATED ***
 *  
 *  Deprecated:
 *    Use CTLineGetOffsetForStringIndex,
 *    CTLineGetStringIndexForPosition instead.
 *  
 *  Summary:
 *    Obtains the highlight region for a range of text.
 *  
 *  Discussion:
 *    Use this function to obtain the screen region that ATSUI would
 *    normally highlight automatically when ATSUHighlightText is
 *    called. This is useful if you wish to perform your own
 *    highlighting.
 *  
 *  Parameters:
 *    
 *    iTextLayout:
 *      A layout containing text to be highlighted.
 *    
 *    iTextBasePointX:
 *      The x-coordinate of the origin (in either the current graphics
 *      port or in a Quartz graphics context) of the line containing
 *      the text range. Pass the constant kATSUUseGrafPortPenLoc to
 *      draw relative to the current pen location in the current
 *      graphics port.
 *    
 *    iTextBasePointY:
 *      The y-coordinate of the origin (in either the current graphics
 *      port or in a Quartz graphics context) of the line containing
 *      the text range. Pass the constant kATSUUseGrafPortPenLoc to
 *      draw relative to the current pen location in the current
 *      graphics port.
 *    
 *    iHighlightStart:
 *      The first character of the text range to be highlighted. If the
 *      text range spans multiple lines, you should call
 *      ATSUGetTextHighlight for each line, passing the offset
 *      corresponding to the beginning of the new line to draw with
 *      each call. To indicate that the specified text range starts at
 *      the beginning of the text buffer, you can pass the constant
 *      kATSUFromTextBeginning. To specify the entire text buffer, pass
 *      kATSUFromTextBeginning in this parameter and kATSUToTextEnd in
 *      the iHighlightLength parameter.
 *    
 *    iHighlightLength:
 *      The length of the text range to be highlighted. To indicate
 *      that the text range extends to the end of the text buffer, pass
 *      the constant kATSUToTextEnd.
 *    
 *    oHighlightRegion:
 *      On return, ATSUGetTextHighlight produces a MacRegion structure
 *      containing the highlight region for the specified range of
 *      text. In the case of discontinuous highlighting, the region
 *      consists of multiple components, with MacRegion.rgnBBox
 *      specifying the bounding box around the entire area of
 *      discontinuous highlighting.
 *  
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework [32-bit only] but deprecated in 10.6
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
function ATSUGetTextHighlight( iTextLayout: ATSUTextLayout; iTextBasePointX: ATSUTextMeasurement; iTextBasePointY: ATSUTextMeasurement; iHighlightStart: UniCharArrayOffset; iHighlightLength: UniCharCount; oHighlightRegion: RgnHandle ): OSStatus; external name '_ATSUGetTextHighlight';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)


{
 *  ATSUHighlightInactiveText()   *** DEPRECATED ***
 *  
 *  Deprecated:
 *    Use CTLineGetOffsetForStringIndex,
 *    CTLineGetStringIndexForPosition  instead.
 *  
 *  Summary:
 *    Highlights text using the standard Mac OS X UI convention for an
 *    inactive window or UI pane.
 *  
 *  Discussion:
 *    Use this function to redraw text when a window or UI pane
 *    containing highlighted text becomes inactive. Once the window or
 *    UI pane becomes active again, call ATSUHighlightText to
 *    rehighlight the text in active mode.
 *  
 *  Parameters:
 *    
 *    iTextLayout:
 *      A layout containing text to be highlighted.
 *    
 *    iTextBasePointX:
 *      The x-coordinate of the origin (in either the current graphics
 *      port or in a Quartz graphics context) of the line containing
 *      the text range. Pass the constant kATSUUseGrafPortPenLoc to
 *      draw relative to the current pen location in the current
 *      graphics port.
 *    
 *    iTextBasePointY:
 *      The y-coordinate of the origin (in either the current graphics
 *      port or in a Quartz graphics context) of the line containing
 *      the text range. Pass the constant kATSUUseGrafPortPenLoc to
 *      draw relative to the current pen location in the current
 *      graphics port.
 *    
 *    iHighlightStart:
 *      The first character of the text range to be highlighted. If the
 *      text range spans multiple lines, you should call
 *      ATSUHighlightInactiveText for each line, passing the offset
 *      corresponding to the beginning of the new line to draw with
 *      each call. To indicate that the specified text range starts at
 *      the beginning of the text buffer, you can pass the constant
 *      kATSUFromTextBeginning. To specify the entire text buffer, pass
 *      kATSUFromTextBeginning in this parameter and kATSUToTextEnd in
 *      the iHighlightLength parameter.
 *    
 *    iHighlightLength:
 *      The length of the text range to be highlighted. To indicate
 *      that the text range extends to the end of the text buffer, pass
 *      the constant kATSUToTextEnd.
 *  
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *  
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework [32-bit only] but deprecated in 10.6
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
function ATSUHighlightInactiveText( iTextLayout: ATSUTextLayout; iTextBasePointX: ATSUTextMeasurement; iTextBasePointY: ATSUTextMeasurement; iHighlightStart: UniCharArrayOffset; iHighlightLength: UniCharCount ): OSStatus; external name '_ATSUHighlightInactiveText';
(* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)


{ ---------------------------------------------------------------------------- }
{  ATSUI hit-testing                                                           }
{ ---------------------------------------------------------------------------- }
{$endc} {not TARGET_CPU_64}

{
 *  ATSUPositionToOffset()   *** DEPRECATED ***
 *  
 *  Deprecated:
 *    Use CTLineGetStringIndexForPosition instead.
 *  
 *  Summary:
 *    Obtains the memory offset for the glyph edge nearest a mouse-down
 *    event.
 *  
 *  Discussion:
 *    The process of hit-testing text obtains the location of a
 *    mouse-down event relative both to the position of onscreen glyphs
 *    and to the corresponding offset between character codes in
 *    memory. You can then use the location information obtained by
 *    hit-testing to set the insertion point (that is, the caret) or
 *    selection range (for highlighting). Hit-testing text is
 *    complicated by the fact that a given line of text may be
 *    bidirectional. Therefore, the onscreen order of glyphs may not
 *    readily correspond to the storage order of the corresponding
 *    character codes. And the concept of which glyph comes "first" in
 *    a line of text cannot always be limited to the visual terms
 *    "left" and "right." Because of these complexities, it is more
 *    accurate to speak in terms of "leading" and "trailing" edges to
 *    glyphs. A "leading edge" is defined as the edge of a glyph that
 *    you first encounter when you read the text that includes that
 *    glyph. For example, when reading Roman text, you first encounter
 *    the left edge of a Roman glyph. Similarly, the "trailing edge" is
 *    defined as the edge of the glyph encountered last. This function
 *    produces the memory offset corresponding to the glyph edge
 *    nearest the event. If the mouse-down event occurs at a line
 *    direction boundary or within a glyph cluster,
 *    ATSUPositionToOffset produces two offsets. You can then provide
 *    the offset(s) to the ATSUOffsetToPosition function to obtain the
 *    actual caret position(s) for the event. When you call the
 *    ATSUPositionToOffset function, ATSUI examines the Unicode
 *    directionality of the character corresponding to the event
 *    location. The ATSUPositionToOffset function produces a value of
 *    true in the oIsLeading parameter if the offset is leading (that
 *    is, more closely associated with the subsequent character in
 *    memory and therefore indicative of a left-to-right line
 *    direction). It produces a value of false if the offset is
 *    trailing (that is, more closely associated with the preceding
 *    character in memory and indicative of a right-to-left line
 *    direction). Finally, note that when the event occurs beyond the
 *    leftmost or rightmost caret positions of the line (not taking
 *    into account line rotation), such that no glyph corresponds to
 *    the location of the hit, the ATSUPositionToOffset function
 *    produces the primary offset of the closest edge of the line to
 *    the input location. The oIsLeading flag depends on the
 *    directionality of the closest glyph and the side of the line to
 *    which the input location is closest. In this case, the secondary
 *    offset is equal to the primary offset, since no glyph was hit.
 *  
 *  Parameters:
 *    
 *    iTextLayout:
 *      The layout object in which the mouse-down event occurred.
 *    
 *    iLocationX:
 *      The x-coordinate of the event, in local coordinates, relative
 *      to the origin of the line where the event occurred. That is, to
 *      specify the x-coordinate value, you should subtract the
 *      x-coordinate of the line origin from the x-coordinate of the
 *      hit point (in local coordinates). You can pass the constant
 *      kATSUUseGrafPortPenLoc for the location of the mouse-down event
 *      relative to the current pen location in the current graphics
 *      port.
 *    
 *    iLocationY:
 *      The y-coordinate of the event, in local coordinates, relative
 *      to the origin of the line where the event occurred. That is, to
 *      specify the y-coordinate value, you should subtract the
 *      y-coordinate of the line origin from the y-coordinate of the
 *      hit point (in local coordinates). You can pass the constant
 *      kATSUUseGrafPortPenLoc for the location of the mouse-down event
 *      relative to the current pen location in the current graphics
 *      port.
 *    
 *    ioPrimaryOffset:
 *      On input, a pointer to a UniCharArrayOffset value specifying
 *      the offset corresponding to the beginning of the line where the
 *      event occurred. On return, the value specifies the offset
 *      corresponding to the glyph edge that is visually closest to the
 *      event. To determine whether this offset indicates the leading
 *      or trailing edge of the glyph, you can examine the value
 *      produced in the oIsLeading parameter.
 *    
 *    oIsLeading:
 *      On return, the value indicates whether the offset produced in
 *      the ioPrimaryOffset parameter is leading or trailing. The
 *      function ATSUPositionToOffset produces a value of true if the
 *      offset is leading (that is, more closely associated with the
 *      subsequent character in memory). It produces a value of false
 *      if the offset is trailing (that is, more closely associated
 *      with the preceding character in memory).
 *    
 *    oSecondaryOffset:
 *      On return, the value typically specifies the same offset as
 *      that produced in the ioPrimaryOffset parameter, unless the
 *      event occurred within a glyph cluster or at a line direction
 *      boundary. If so, the value specifies a secondary offset. The
 *      secondary offset is associated with the glyph that has a
 *      different direction from the primary line direction.
 *  
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework but deprecated in 10.6
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
function ATSUPositionToOffset( iTextLayout: ATSUTextLayout; iLocationX: ATSUTextMeasurement; iLocationY: ATSUTextMeasurement; var ioPrimaryOffset: UniCharArrayOffset; var oIsLeading: Boolean; var oSecondaryOffset: UniCharArrayOffset ): OSStatus; external name '_ATSUPositionToOffset';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)


{$ifc not TARGET_CPU_64}
{
 *  ATSUOffsetToPosition()   *** DEPRECATED ***
 *  
 *  Deprecated:
 *    Use CTLineGetStringIndexForPosition instead.
 *  
 *  Summary:
 *    Obtains the caret position(s) corresponding to a memory offset.
 *  
 *  Discussion:
 *    This function produces two structures of type ATSUCaret. These
 *    structures contain the pen positioning information needed to draw
 *    the caret(s) for the event, specified relative to the origin of
 *    the line in the current graphics port or graphics context.
 *    Specifically, the ATSUCaret structures contain x-y coordinates
 *    for both the caret's starting and ending pen positions (the
 *    latter taking into account line rotation, caret slanting, and
 *    split-caret appearances). If the offset you pass to
 *    ATSUOffsetToPosition is at a line boundary, the structure
 *    produced in the oMainCaret parameter contains the starting and
 *    ending pen locations for the high caret, while the oSecondCaret
 *    parameter contains the corresponding values for the low caret. If
 *    the offset is not at a line boundary, both parameters contain the
 *    starting and ending pen locations of the main caret. Because you
 *    provide the ATSUOffsetToPosition function an offset relative to
 *    the origin of the line where the hit occurred,
 *    ATSUOffsetToPosition produces positioning information that is
 *    also relative. Therefore, you must transform the positions
 *    produced by the ATSUOffsetToPosition function before drawing the
 *    caret(s). To transform the caret location(s), add the starting
 *    and ending caret coordinates to the coordinates of the origin of
 *    the line in which the hit occurred. For example, if
 *    ATSUOffsetToPosition produces starting and ending pen locations
 *    of (25,0), (25,25) in the oMainCaret parameter (and the
 *    oSecondCaret parameter contains the same coordinates, meaning
 *    that the caret was not split), you would add these to the
 *    position of the origin of the line in the graphics port or
 *    context. If the position of the line origin was at (50,50), then
 *    the starting and ending pen locations of the caret would be
 *    (75,50), (75,75).
 *  
 *  Parameters:
 *    
 *    iTextLayout:
 *      The layout containing the offset.
 *    
 *    iOffset:
 *      The offset into the text buffer for which you wish to obtain a
 *      caret position. To respond to a mouse-down event, pass the
 *      offset returned in the ioPrimaryOffset parameter from the
 *      function ATSUPositionToOffset. That is, the offset
 *      corresponding to the glyph edge closest to the event.
 *    
 *    iIsLeading:
 *      A Boolean value indicating whether the offset corresponds to
 *      the leading or trailing edge of the glyph. You can obtain this
 *      information from the function ATSUPositionToOffset. This value
 *      is relevant if the offset occurs at a line direction boundary
 *      or within a glyph cluster.
 *    
 *    oMainCaret:
 *      On return, contains the starting and ending pen locations of
 *      the high caret if the value produced in oCaretIsSplit is true.
 *      If the value is false, the structure contains the starting and
 *      ending pen locations of the main caret.
 *    
 *    oSecondCaret:
 *      On return, contains the starting and ending pen locations of
 *      the low caret if the value passed back in the oCaretIsSplit
 *      parameter is true. If the value is false, the structure
 *      contains the starting and ending pen locations of the main
 *      caret (that is, the same values as the oMainCaret parameter).
 *    
 *    oCaretIsSplit:
 *      On return, indicates whether the offset specified in the
 *      iOffset parameter occurs at a line direction boundary. If true,
 *      the offset occurs at a line direction boundary; otherwise,
 *      false.
 *  
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework [32-bit only] but deprecated in 10.6
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
function ATSUOffsetToPosition( iTextLayout: ATSUTextLayout; iOffset: UniCharArrayOffset; iIsLeading: Boolean; var oMainCaret: ATSUCaret; var oSecondCaret: ATSUCaret; var oCaretIsSplit: Boolean ): OSStatus; external name '_ATSUOffsetToPosition';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)


{
 *  ATSUPositionToCursorOffset()   *** DEPRECATED ***
 *  
 *  Deprecated:
 *    Use CTLineGetOffsetForStringIndex instead.
 *  
 *  Summary:
 *    Obtains the memory offset for the glyph edge nearest a mouse-down
 *    event, after a move of the specified length.
 *  
 *  Discussion:
 *    This function produces the memory offset for the glyph edge
 *    nearest a mouse-down event, after a move of the specified length.
 *    This offset corresponds to where an insertion point would be
 *    placed after the move.
 *  
 *  Parameters:
 *    
 *    iTextLayout:
 *      The layout in which the mouse down event occured.
 *    
 *    iLocationX:
 *      The x-coordinate of the event, in local coordinates, relative
 *      to the origin of the line where the event occurred. That is, to
 *      specify the x-coordinate value, you should subtract the
 *      x-coordinate of the line origin from the x-coordinate of the
 *      hit point (in local coordinates). You can pass the constant
 *      kATSUUseGrafPortPenLoc for the location of the mouse-down event
 *      relative to the current pen location in the current graphics
 *      port.
 *    
 *    iLocationY:
 *      The y-coordinate of the event, in local coordinates, relative
 *      to the origin of the line where the event occurred. That is, to
 *      specify the y-coordinate value, you should subtract the
 *      y-coordinate of the line origin from the y-coordinate of the
 *      hit point (in local coordinates). You can pass the constant
 *      kATSUUseGrafPortPenLoc for the location of the mouse-down event
 *      relative to the current pen location in the current graphics
 *      port.
 *    
 *    iMovementType:
 *      A constant specifying the type of cursor movement to use. See
 *      the definition of ATSUCursorMovementType for possible values to
 *      pass for this parameter.
 *    
 *    ioPrimaryOffset:
 *      On input, the offset corresponding to the beginning of the line
 *      where the event occurred. On return, the offset corresponding
 *      to the glyph edge nearest the event, after a movement of the
 *      specified type. This offset corresponds to where the insertion
 *      point would be placed after the move. To determine whether this
 *      offset indicates the leading or trailing edge of the glyph, you
 *      can examine the value produced in the oIsLeading parameter.
 *    
 *    oIsLeading:
 *      On return, the value indicates whether the offset produced in
 *      the ioPrimaryOffset parameter is leading or trailing. The
 *      ATSUPositionToOffset function produces a value of true if the
 *      offset is leading (that is, more closely associated with the
 *      subsequent character in memory). It produces a value of false
 *      if the offset is trailing (that is, more closely associated
 *      with the preceding character in memory).
 *    
 *    oSecondaryOffset:
 *      On return, the value typically specifies the same offset as
 *      that produced in the ioPrimaryOffset parameter, unless the
 *      event occurred within a glyph cluster or at a line direction
 *      boundary. If so, the value specifies the secondary offset, for
 *      the glyph edge furthest from the event.
 *  
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework [32-bit only] but deprecated in 10.6
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 9.2.2 and later
 }
function ATSUPositionToCursorOffset( iTextLayout: ATSUTextLayout; iLocationX: ATSUTextMeasurement; iLocationY: ATSUTextMeasurement; iMovementType: ATSUCursorMovementType; var ioPrimaryOffset: UniCharArrayOffset; var oIsLeading: Boolean; var oSecondaryOffset: UniCharArrayOffset ): OSStatus; external name '_ATSUPositionToCursorOffset';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)


{
 *  ATSUOffsetToCursorPosition()   *** DEPRECATED ***
 *  
 *  Deprecated:
 *    Use CTLineGetOffsetForStringIndex,
 *    CTLineGetStringIndexForPosition instead.
 *  
 *  Summary:
 *    Obtains the caret position(s) corresponding to a memory offset,
 *    after a move of the specified length.
 *  
 *  Discussion:
 *    Use this function in conjunction with ATSUPositionToCursorOffset
 *    to determine where to draw the caret after a mouse-down event.
 *    The movement type parameter allows you to have the cursor "snap"
 *    to different parts of the text depending on the type of movement
 *    selected (i.e., words or characters). See the definition of
 *    ATSUCursorMovementType for more information on possible values.
 *  
 *  Parameters:
 *    
 *    iTextLayout:
 *      The text layout object in which the mouse-down event occurred.
 *    
 *    iOffset:
 *      The offset corresponding to the glyph edge nearest the event,
 *      after a movement of the specified type. You can obtain this
 *      value by examining the offset produced in the ioPrimaryOffset
 *      parameter of the function ATSUPositionToCursorOffset.
 *    
 *    iIsLeading:
 *      A Boolean value indicating whether the specified offset
 *      corresponds to the leading or trailing edge of the glyph. You
 *      can obtain this information from the function
 *      ATSUPositionToCursorOffset . This value is relevant if the
 *      offset occurs at a line direction boundary or within a glyph
 *      cluster.
 *    
 *    iMovementType:
 *      A constant specifying the unit of cursor movement. See the
 *      definition of ATSUCursorMovementType for possible values to
 *      pass for this parameter.
 *    
 *    oMainCaret:
 *      On return, the structure contains the starting and ending pen
 *      locations of the high caret if the value produced in the
 *      oCaretIsSplit parameter is true. If the value is false, the
 *      structure contains the starting and ending pen locations of the
 *      main caret.
 *    
 *    oSecondCaret:
 *      On return, the structure contains the starting and ending pen
 *      locations of the low caret if the value passed back in the
 *      oCaretIsSplit parameter is true. If the value is false, the
 *      structure contains the starting and ending pen locations of the
 *      main caret (that is, the same values as the oMainCaret
 *      parameter).
 *    
 *    oCaretIsSplit:
 *      On return, the value indicates whether the offset specified in
 *      the iOffset parameter occurs at a line direction boundary. If
 *      true, the offset occurs at a line direction boundary;
 *      otherwise, false.
 *  
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework [32-bit only] but deprecated in 10.6
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 9.2.2 and later
 }
function ATSUOffsetToCursorPosition( iTextLayout: ATSUTextLayout; iOffset: UniCharArrayOffset; iIsLeading: Boolean; iMovementType: ATSUCursorMovementType; var oMainCaret: ATSUCaret; var oSecondCaret: ATSUCaret; var oCaretIsSplit: Boolean ): OSStatus; external name '_ATSUOffsetToCursorPosition';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)


{ ---------------------------------------------------------------------------- }
{  ATSUI cursor movement                                                       }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUNextCursorPosition()   *** DEPRECATED ***
 *  
 *  Deprecated:
 *    Use CTLineGetOffsetForStringIndex,
 *    CTLineGetStringIndexForPosition instead.
 *  
 *  Summary:
 *    Obtains the memory offset for the insertion point that follows
 *    the current insertion point in storage order, as determined by a
 *    move of the specified length and type.
 *  
 *  Discussion:
 *    Together with ATSUPreviousCursorPosition, this function allows an
 *    application to "walk" the text buffer in storage order, moving
 *    the cursor by a specified amount and movement type at each step.
 *    To move through the text buffer in screen order, use the
 *    functions ATSURightwardCursorPosition and
 *    ATSULeftwardCursorPosition.
 *  
 *  Parameters:
 *    
 *    iTextLayout:
 *      The layout in which to perform the cursor movement.
 *    
 *    iOldOffset:
 *      The previous cursor position.
 *    
 *    iMovementType:
 *      A constant specifying the unit of cursor movement. See the
 *      definition of ATSUCursorMovementType for possible values to
 *      pass for this parameter.
 *    
 *    oNewOffset:
 *      On return, the new cursor position.
 *  
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework [32-bit only] but deprecated in 10.6
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
function ATSUNextCursorPosition( iTextLayout: ATSUTextLayout; iOldOffset: UniCharArrayOffset; iMovementType: ATSUCursorMovementType; var oNewOffset: UniCharArrayOffset ): OSStatus; external name '_ATSUNextCursorPosition';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)


{
 *  ATSUPreviousCursorPosition()   *** DEPRECATED ***
 *  
 *  Deprecated:
 *    Use CTLineGetOffsetForStringIndex,
 *    CTLineGetStringIndexForPosition instead.
 *  
 *  Summary:
 *    Obtains the memory offset for the insertion point that preceeds
 *    the current insertion point in storage order, as determined by a
 *    move of the specified length and type.
 *  
 *  Discussion:
 *    Together with ATSUNextCursorPosition, this function allows an
 *    application to "walk" the text buffer in storage order, moving
 *    the cursor by a specified amount and movement type at each step.
 *    To move through the text buffer in screen order, use the
 *    functions ATSURightwardCursorPosition and
 *    ATSULeftwardCursorPosition.
 *  
 *  Parameters:
 *    
 *    iTextLayout:
 *      The layout in which to perform the cursor movement.
 *    
 *    iOldOffset:
 *      The previous cursor position.
 *    
 *    iMovementType:
 *      A constant specifying the unit of cursor movement. See the
 *      definition of ATSUCursorMovementType for possible values to
 *      pass for this parameter.
 *    
 *    oNewOffset:
 *      On return, the new cursor position.
 *  
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework [32-bit only] but deprecated in 10.6
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
function ATSUPreviousCursorPosition( iTextLayout: ATSUTextLayout; iOldOffset: UniCharArrayOffset; iMovementType: ATSUCursorMovementType; var oNewOffset: UniCharArrayOffset ): OSStatus; external name '_ATSUPreviousCursorPosition';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)


{
 *  ATSURightwardCursorPosition()   *** DEPRECATED ***
 *  
 *  Deprecated:
 *    Use CTLineGetOffsetForStringIndex,
 *    CTLineGetStringIndexForPosition instead.
 *  
 *  Summary:
 *    Obtains the memory offset for the insertion point that is to the
 *    right of the current insertion point, as determined by a move of
 *    the specified length and type.
 *  
 *  Discussion:
 *    Together with ATSULeftwardCursorPosition, this function allows an
 *    application to "walk" the text buffer in screen order, moving the
 *    cursor by a specified amount and movement type at each step. To
 *    move through the text buffer in storage order, use the functions
 *    ATSUNextCursorPosition and ATSUPreviousCursorPosition. Note that
 *    if you are drawing the cursor after a cursor move, you should use
 *    ATSUOffsetToPosition to obtain an ATSUCaret that determines the
 *    on screen location of the new cursor position. Always store the
 *    ATSUCaret from the previous cursor position as well, as this can
 *    help determine which caret to use in the case of a split caret.
 *    When performing leftward and rightward cursor movement, always
 *    use the caret closest to the previous caret. This maintains
 *    visual order when moving the cursor on screen.
 *  
 *  Parameters:
 *    
 *    iTextLayout:
 *      The layout in which to perform the cursor movement.
 *    
 *    iOldOffset:
 *      The previous cursor position.
 *    
 *    iMovementType:
 *      A constant specifying the unit of cursor movement. See the
 *      definition of ATSUCursorMovementType for possible values to
 *      pass for this parameter.
 *    
 *    oNewOffset:
 *      On return, the new cursor position.
 *  
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework [32-bit only] but deprecated in 10.6
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
function ATSURightwardCursorPosition( iTextLayout: ATSUTextLayout; iOldOffset: UniCharArrayOffset; iMovementType: ATSUCursorMovementType; var oNewOffset: UniCharArrayOffset ): OSStatus; external name '_ATSURightwardCursorPosition';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)


{
 *  ATSULeftwardCursorPosition()   *** DEPRECATED ***
 *  
 *  Deprecated:
 *    Use CTLineGetOffsetForStringIndex,
 *    CTLineGetStringIndexForPosition instead.
 *  
 *  Summary:
 *    Obtains the memory offset for the insertion point that is to the
 *    left of the current insertion point, as determined by a move of
 *    the specified length and type.
 *  
 *  Discussion:
 *    Together with ATSURightwardCursorPosition, this function allows
 *    an application to "walk" the text buffer in screen order, moving
 *    the cursor by a specified amount and movement type at each step.
 *    To move through the text buffer in storage order, use the
 *    functions ATSUNextCursorPosition and ATSUPreviousCursorPosition.
 *    Note that if you are drawing the cursor after a cursor move, you
 *    should use ATSUOffsetToPosition to obtain an ATSUCaret that
 *    determines the on screen location of the new cursor position.
 *    Always store the ATSUCaret from the previous cursor position as
 *    well, as this can help determine which caret to use in the case
 *    of a split caret. When performing leftward and rightward cursor
 *    movement, always use the caret closest to the previous caret.
 *    This maintains visual order when moving the cursor on screen.
 *  
 *  Parameters:
 *    
 *    iTextLayout:
 *      The layout in which to perform the cursor movement.
 *    
 *    iOldOffset:
 *      The previous cursor position.
 *    
 *    iMovementType:
 *      A constant specifying the unit of cursor movement. See the
 *      definition of ATSUCursorMovementType for possible values to
 *      pass for this parameter.
 *    
 *    oNewOffset:
 *      On return, the new cursor position.
 *  
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework [32-bit only] but deprecated in 10.6
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
function ATSULeftwardCursorPosition( iTextLayout: ATSUTextLayout; iOldOffset: UniCharArrayOffset; iMovementType: ATSUCursorMovementType; var oNewOffset: UniCharArrayOffset ): OSStatus; external name '_ATSULeftwardCursorPosition';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)


{ Functions listed beyond this point are either deprecated or not recommended }

{
 *  ATSUMeasureText()   *** DEPRECATED ***
 *  
 *  Deprecated:
 *    Use ATSUGetUnjustifiedBounds instead.
 *  
 *  Discussion:
 *    This function is no longer recommended. Please use
 *    ATSUGetUnjustifiedBounds instead.
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework [32-bit only] but deprecated in 10.3
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
function ATSUMeasureText( iTextLayout: ATSUTextLayout; iLineStart: UniCharArrayOffset; iLineLength: UniCharCount; var oTextBefore: ATSUTextMeasurement; var oTextAfter: ATSUTextMeasurement; var oAscent: ATSUTextMeasurement; var oDescent: ATSUTextMeasurement ): OSStatus; external name '_ATSUMeasureText';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_3 *)


{$endc} {not TARGET_CPU_64}

{$endc} {TARGET_OS_MAC}
{$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}

end.
{$endc} {not MACOSALLINCLUDE}