summaryrefslogtreecommitdiffstats
path: root/unicode/book.xml
blob: 77445017f85315de59b334a7c4013066de21e105 (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
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
 "https://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [

<!ENTITY tr9ver  "42">
<!ENTITY tr14ver "45">
<!ENTITY tr15ver "50">
<!ENTITY tr24ver "31">
<!ENTITY tr29ver "37">
<!ENTITY tr51ver "18">

]>

<!--

Copyright 2014-2021 Double Precision, Inc.
See COPYING for distribution information.

-->

<article id="index">
  <title>Courier Unicode Library</title>

  <para>
    This library implements several algorithms related to the
    <ulink url="https://www.unicode.org/standard/standard.html">Unicode
    Standard</ulink>, featuring:
  </para>

  <itemizedlist>
    <listitem>
      <para>
	Both C and C++11 bindings, with a
	<link linkend="courier-unicode">complete manual page
	documentation set</link>.
      </para>
    </listitem>

    <listitem>
      <para>
	The library has all Unicode mappings compiled in as fast, compact,
	lookup table. The library does not need to load the Unicode database
	files at startup, every time.
      </para>
    </listitem>
    <listitem>
      <para>
	The library implements lookups uppercase, lowercase, and
	titlecase equivalents of a unicode character;
	<link linkend="unicode_grapheme_break">grapheme
	and word breaking</link> rules;
	<link linkend="unicode_line_break">line	breaking</link> rules;
	and the
	<link linkend="unicode_bidi">bi-directional
	algorithm</link>.
      </para>
    </listitem>
    <listitem>
      <para>
	The library implements <link linkend="unicode_canonical">canonical
	and compatibility decomposition and composition</link> of Unicode text;
	and the <link linkend="unicode_script">Unicode script property</link>.
      </para>
    </listitem>
    <listitem>
      <para>
	The library also implements ancillary functions, like looking up
	the unicode character that corresponds to some HTML 4.0
	entity (such as <quote>&amp;amp;</quote>, for example), and
	determining the normal width or a double-width status of a unicode
	character. Also, an adaptation of the
	<ulink url="https://manpages.courier-mta.org/htmlman3/iconv.3.html">
	<citerefentry><refentrytitle>iconv</refentrytitle>
	<manvolnum>3</manvolnum></citerefentry></ulink>
	API for this unicode library.
      </para>
    </listitem>
  </itemizedlist>

  <section id="status">
    <title>Current status</title>

    <para>
      The current release of the Courier Unicode library is based on the
      Unicode 13.0.0 standard.
    </para>
  </section>

  <section id="INSTALL">
    <title>Installation and usage</title>

    <para>
      Download the current version of the library from
      <ulink url="/download.html#unicode">https://www.courier-mta.org/download.html#unicode</ulink>.
      Use the downloaded tarball to prepare an appropriate installation
      package for your operating system distribution.
      The typical sequence of commands is:
    </para>

    <blockquote>
      <informalexample>
	<programlisting>
./configure    # Takes the default configure script options
make
make install DESTDIR=/tmp/courier-unicode-instimage # For example.</programlisting>
      </informalexample>
    </blockquote>

    <para>
      The library uses a stock configure script, <command>make</command>
      and <command>make install</command> command that respects the
      <varname>DESTDIR</varname> setting to create an installation image
      in the directory specified by <varname>DESTDIR</varname>.
    </para>

    <note>
      <para>
	<command>make install</command> does not take any explicit action
	to uninstall any older version of the library, or remove any files
	from an older version that do not exist any more in the new version.
	Use the created installation image to prepare an
	installable package in a native package format for your operating
	system distribution. Use your native system distribution's package
	manager to properly install and update this library.
      </para>
    </note>

    <para>
      To use the library, <quote>#include &lt;courier-unicode.h&gt;</quote> and link
      with <literal>-lcourier-unicode</literal>.
      The C++ compiler must have C++11 support. Minimum usable version of
      gcc appears to be gcc 4.4 with the <literal>-std=c++0x</literal> flag.
      Current versions of gcc use C++11, or higher, by default and do not
      require extra flags. For C++ code, as usual, the compiler and compilation
      flags for compiling any code that uses this library must be ABI-compatible
      too.
    </para>

    <para>
      The Courier Unicode library installs an
      <application>autoconf</application> macro to probe for C++11 support.
      In your <filename>configure.ac</filename>
    </para>

    <blockquote>
      <informalexample>
	<programlisting>
	  AX_COURIER_UNICODE_VERSION
	  AX_COURIER_UNICODE_CXXFLAGS

	  AC_SUBST(COURIER_UNICODE_CXXFLAGS)
	</programlisting>
      </informalexample>
    </blockquote>

    <para>
      Then, in <filename>Makefile.am</filename>:
    </para>

    <blockquote>
      <informalexample>
	<programlisting>
	  AM_CXXFLAGS = @COURIER_UNICODE_CXXFLAGS@
	</programlisting>
      </informalexample>
    </blockquote>

    <para>
      The <varname>AX_COURIER_UNICODE_VERSION</varname> macro
      checks the minimum library version, which defaults to the build
      version. An optional parameter explicitly specifies which version
      of the Courier Unicode library is the minimum version required, i.e.:
    </para>

    <blockquote>
      <informalexample>
	<programlisting>
	AX_COURIER_UNICODE_VERSION(2.2.0)</programlisting>
      </informalexample>
    </blockquote>

    <para>
      <varname>AX_COURIER_UNICODE_CXXFLAGS</varname> sets
      <varname>COURIER_UNICODE_CXXFLAGS</varname> to the appropriate option
      for older gcc compilers that require an option to enable C++11
      support.
    </para>

    <para>
      The starting point for the library documentation is
      <link linkend="courier-unicode">
	<citerefentry>
	  <refentrytitle>courier-unicode</refentrytitle>
	  <manvolnum>7</manvolnum></citerefentry></link>.
	  Refer to the included manual pages,
	  and
	  <ulink url="https://www.courier-mta.org/unicode/manpages.html"> the HTML
	  version of the man pages</ulink> for more information.
    </para>
  </section>

  <section id="manpages">
    <title>Manual pages</title>

    <section id="manpagesc">
      <title>C manual pages</title>
      <refentry id="courier-unicode">

	<refentryinfo><author><firstname>Sam</firstname><surname>Varshavchik</surname><contrib>Author</contrib></author><productname>Courier Unicode Library</productname></refentryinfo>
	<refmeta>
	  <refentrytitle>courier-unicode</refentrytitle>
	  <manvolnum>7</manvolnum>
	</refmeta>

	<refnamediv>
	  <refname>courier-unicode</refname>
	  <refpurpose>Courier Unicode Library</refpurpose>

	</refnamediv>

	<refsynopsisdiv>
	  <programlisting>
#include &lt;courier-unicode.h&gt;</programlisting>
	</refsynopsisdiv>
	<refsect1 id="courier_unicode_descr">
	  <title>DESCRIPTION</title>

	  <para>
	    This library implements several algorithms related to the
	    <ulink url="https://www.unicode.org/standard/standard.html">Unicode
	    Standard</ulink>.
	    This library uses
	    <ulink url="https://manpages.courier-mta.org/htmlman3/iconv.3.html"
		   ><citerefentry><refentrytitle>iconv</refentrytitle>
	    <manvolnum>3</manvolnum></citerefentry></ulink> to convert
	      text in a given character set to unicode. Any character set
	      displayed by <command>iconv --list</command> can be specified
	      for the corresponding character set parameter. Additionally,
	      <filename>courier-unicode.h</filename> defines a special character
	      string <literal>unicode_x_imap_modutf7</literal> that specifies
	      the pseudo-character set for the modified-UTF7
	      encoding used in IMAP. This string can also be appended by
	      a space, and up to fifteen additional US-ASCII characters.
	      The resulting character set also encodes these additional
	      characters, in addition to unicode characters, with
	      modified-UTF7.
	  </para>

	  <para>
	    The C++ compiler must have C++11 support. Minimum usable version of
	    gcc appears to be gcc 4.4 with the <literal>-std=c++0x</literal>
	    flag. Current versions of gcc use C++11, or higher, by default and
	    do not require extra flags. Consult the packaging documentation
	    for the Courier Unicode Library for information on any
	    compiler flags that are needed to build software that links
	    with this library.
	  </para>
	</refsect1>
	<refsect1 id="courier_unicode_seealso">
	  <title>SEE ALSO</title>

	  <para>
	    <link linkend="unicode_bidi">
	      <citerefentry><refentrytitle>unicode_bidi</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	    <link linkend="unicode_canonical">
	      <citerefentry><refentrytitle>unicode_canonical</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	    <link linkend="unicode_category_lookup">
	      <citerefentry><refentrytitle>unicode_category_lookup</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	    <link linkend="unicode_convert">
	      <citerefentry><refentrytitle>unicode_convert</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	    <link linkend="unicode_default_chset">
	      <citerefentry><refentrytitle>unicode_default_chset</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	    <link linkend="unicode_emoji_lookup">
	      <citerefentry><refentrytitle>unicode_emoji_lookup</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	    <link linkend="unicode_html40ent_lookup">
	      <citerefentry><refentrytitle>unicode_html40ent_lookup</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	    <link linkend="unicode_grapheme_break">
	      <citerefentry><refentrytitle>unicode_grapheme_break</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	    <link linkend="unicode_line_break">
	      <citerefentry><refentrytitle>unicode_line_break</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	    <link linkend="unicode_script">
	      <citerefentry><refentrytitle>unicode_script</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	    <link linkend="unicode_uc">
	      <citerefentry><refentrytitle>unicode_uc</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	    <link linkend="unicode_word_break">
	      <citerefentry><refentrytitle>unicode_word_break</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	    <link linkend="unicode__bidi">
	      <citerefentry><refentrytitle>unicode::bidi</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	    <link linkend="unicode__canonical">
	      <citerefentry><refentrytitle>unicode::canonical</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	    <link linkend="unicode__iconvert__convert">
	      <citerefentry><refentrytitle>unicode::iconvert::convert</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	    <link linkend="unicode__iconvert__convert_tocase">
	      <citerefentry><refentrytitle>unicode::iconvert::convert_tocase</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	    <link linkend="unicode__iconvert__fromu">
	      <citerefentry><refentrytitle>unicode::iconvert::fromu</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	    <link linkend="unicode__iconvert__tou">
	      <citerefentry><refentrytitle>unicode::iconvert::tou</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	    <link linkend="unicode__tolower">
	      <citerefentry><refentrytitle>unicode::tolower</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	    <link linkend="unicode__linebreak">
	      <citerefentry><refentrytitle>unicode::linebreak</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	    <link linkend="unicode__wordbreak">
	      <citerefentry><refentrytitle>unicode::wordbreak</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>.
	  </para>
	</refsect1>
      </refentry>

      <refentry id="unicode_bidi">
	<refentryinfo><author><firstname>Sam</firstname><surname>Varshavchik</surname><contrib>Author</contrib></author><productname>Courier Unicode Library</productname></refentryinfo>

	<refmeta>
	  <refentrytitle>unicode_bidi</refentrytitle>
	  <manvolnum>3</manvolnum>
	</refmeta>

	<refnamediv>
	  <refname>unicode_bidi</refname>
	  <refname>unicode_bidi_calc_levels</refname>
	  <refname>unicode_bidi_calc_types</refname>
	  <refname>unicode_bidi_calc</refname>
	  <refname>unicode_bidi_reorder</refname>
	  <refname>unicode_bidi_cleanup</refname>
	  <refname>unicode_bidi_cleaned_size</refname>
	  <refname>unicode_bidi_logical_order</refname>
	  <refname>unicode_bidi_combinings</refname>
	  <refname>unicode_bidi_needs_embed</refname>
	  <refname>unicode_bidi_embed</refname>
	  <refname>unicode_bidi_embed_paragraph_level</refname>

	  <refname>unicode_bidi_direction</refname>
	  <refname>unicode_bidi_type</refname>
	  <refname>unicode_bidi_setbnl</refname>
	  <refname>unicode_bidi_mirror</refname>
	  <refname>unicode_bidi_bracket_type</refname>

	  <refpurpose>unicode bi-directional algorithm</refpurpose>
	</refnamediv>

	<refsynopsisdiv>
	  <funcsynopsis>
	    <funcsynopsisinfo>#include &lt;courier-unicode.h&gt;&#10;&#10;unicode_bidi_level_t lr=UNICODE_BIDI_LR;</funcsynopsisinfo>

	    <funcprototype>
	      <funcdef>void <function>unicode_bidi_calc_types</function></funcdef>
              <paramdef>const char32_t *<parameter>p</parameter></paramdef>
              <paramdef>size_t <parameter>n</parameter></paramdef>
              <paramdef>unicode_bidi_type_t *<parameter>types</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>struct unicode_bidi_direction <function>unicode_bidi_calc_levels</function></funcdef>
              <paramdef>const char32_t *<parameter>p</parameter></paramdef>
              <paramdef>const unicode_bidi_type_t *<parameter>types</parameter></paramdef>
              <paramdef>size_t <parameter>n</parameter></paramdef>
              <paramdef>unicode_bidi_level_t *<parameter>levels</parameter></paramdef>
              <paramdef>const unicode_bidi_level_t *<parameter>initial_embedding_level</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>struct unicode_bidi_direction <function>unicode_bidi_calc</function></funcdef>
              <paramdef>const char32_t *<parameter>p</parameter></paramdef>
              <paramdef>size_t <parameter>n</parameter></paramdef>
              <paramdef>unicode_bidi_level_t *<parameter>levels</parameter></paramdef>
              <paramdef>const unicode_bidi_level_t *<parameter>initial_embedding_level</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>void <function>unicode_bidi_reorder</function></funcdef>
              <paramdef>char32_t *<parameter>string</parameter></paramdef>
              <paramdef>unicode_bidi_level_t *<parameter>levels</parameter></paramdef>
              <paramdef>size_t <parameter>n</parameter></paramdef>
              <paramdef>void (*<parameter>reorder_callback</parameter>)(size_t, size_t, void *)</paramdef>
	      <paramdef>void *<parameter>arg</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>size_t <function>unicode_bidi_cleanup</function></funcdef>
              <paramdef>char32_t *<parameter>string</parameter></paramdef>
              <paramdef>unicode_bidi_level_t *<parameter>levels</parameter></paramdef>
              <paramdef>size_t <parameter>n</parameter></paramdef>
	      <paramdef>int <parameter>options</parameter></paramdef>
              <paramdef>void (*<parameter>removed_callback</parameter>)(size_t, size_t, void *)</paramdef>
	      <paramdef>void *<parameter>arg</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>size_t <function>unicode_bidi_cleaned_size</function></funcdef>
              <paramdef>const char32_t *<parameter>string</parameter></paramdef>
              <paramdef>size_t <parameter>n</parameter></paramdef>
	      <paramdef>int <parameter>options</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>void <function>unicode_bidi_logical_order</function></funcdef>
              <paramdef>char32_t *<parameter>string</parameter></paramdef>
              <paramdef>unicode_bidi_level_t *<parameter>levels</parameter></paramdef>
              <paramdef>size_t <parameter>n</parameter></paramdef>
              <paramdef>unicode_bidi_level_t <parameter>paragraph_embedding</parameter></paramdef>
              <paramdef>void (*<parameter>reorder_callback</parameter>)(size_t index, size_t n, void *arg)</paramdef>
	      <paramdef>void *<parameter>arg</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>void <function>unicode_bidi_combinings</function></funcdef>
              <paramdef>const char32_t *<parameter>string</parameter></paramdef>
              <paramdef>const unicode_bidi_level_t *<parameter>levels</parameter></paramdef>
              <paramdef>size_t <parameter>n</parameter></paramdef>
	      <paramdef>void (*<parameter>combinings</parameter>)(unicode_bidi_level_t level, size_t level_start, size_t n_chars, size_t comb_start, size_t n_comb_chars, void *arg)</paramdef>
	      <paramdef>void *<parameter>arg</parameter></paramdef>
	    </funcprototype>
	    <funcprototype>
	      <funcdef>int <function>unicode_bidi_needs_embed</function></funcdef>
              <paramdef>const char32_t *<parameter>string</parameter></paramdef>
              <paramdef>const unicode_bidi_level_t *<parameter>levels</parameter></paramdef>
              <paramdef>size_t <parameter>n</parameter></paramdef>
              <paramdef>const unicode_bidi_level_t <parameter>*paragraph_embedding</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>size_t <function>unicode_bidi_embed</function></funcdef>
              <paramdef>const char32_t *<parameter>string</parameter></paramdef>
              <paramdef>const unicode_bidi_level_t *<parameter>levels</parameter></paramdef>
              <paramdef>size_t <parameter>n</parameter></paramdef>
              <paramdef>unicode_bidi_level_t <parameter>paragraph_embedding</parameter></paramdef>
              <paramdef>void (*<parameter>emit</parameter>)(const char32_t *string, size_t n, int is_part_of_string, void *arg)</paramdef>
	      <paramdef>void *<parameter>arg</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>char32_t <function>unicode_bidi_embed_paragraph_level</function></funcdef>
              <paramdef>const char32_t *<parameter>string</parameter></paramdef>
              <paramdef>size_t <parameter>n</parameter></paramdef>
              <paramdef>unicode_bidi_level_t <parameter>paragraph_embedding</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>char32_t <function>bidi_mirror</function></funcdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>char32_t <function>bidi_bracket_type</function></funcdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
              <paramdef>unicode_bracket_type_t *<parameter>ret</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>struct unicode_bidi_direction <function>unicode_bidi_get_direction</function></funcdef>
              <paramdef>char32_t *<parameter>c</parameter></paramdef>
              <paramdef>size_t <parameter>n</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>enum_bidi_type_t <function>unicode_bidi_type</function></funcdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>void <function>unicode_bidi_setbnl</function></funcdef>
              <paramdef>char32_t *<parameter>p</parameter></paramdef>
              <paramdef>const unicode_bidi_type_t *<parameter>types</parameter></paramdef>
              <paramdef>size_t <parameter>n</parameter></paramdef>
	    </funcprototype>

	  </funcsynopsis>
	</refsynopsisdiv>
	<refsect1 id="unicode_bidi_descr">
	  <title>DESCRIPTION</title>

	  <para>
	    These functions are related to the
	    <ulink url="https://www.unicode.org/reports/tr9/tr9-&tr9ver;.html"> Unicode Bi-Directional algorithm</ulink>.
	    They implement the algorithm up to and including step L2,
	    and provide additional functionality of returning miscellaneous
	    bi-directional-related metadata of Unicode characters. There's
	    also a basic algorithm that <quote>reverses</quote> the
	    bi-directional algorithm
	    and produces a Unicode string with bi-directional markers that
	    results in the same bi-directional string after reapplying the
	    algorithm.
	  </para>

	  <refsect2 id="unicode_bidi_calc_reorder">
	    <title>Calculating bi-directional rendering order</title>

	    <para>
	      The following process computes the rendering order of
	      characters according to the Unicode Bi-Directional algorithm:
	    </para>

	    <orderedlist>
	      <listitem>
		<para>
		  Allocate an array of
		  <structname>unicode_bidi_type_t</structname> that's the
		  same size as the Unicode string.
		</para>
	      </listitem>
	      <listitem>
		<para>
		  Allocate an array of
		  <structname>unicode_bidi_level_t</structname> that's the
		  same size as the Unicode string.
		</para>
	      </listitem>

	      <listitem>
		<para>
		  Use <function>unicode_bidi_calc_types</function>() to compute
		  the Unicode string's characters' bi-directional types,
		  and populate the
		  <structname>unicode_bidi_type_t</structname> buffer.
		</para>
	      </listitem>

	      <listitem>
		<para>
		  Use <function>unicode_bidi_calc_levels</function>() to compute
		  the Unicode string's characters' bi-directional embedding
		  level (executes the Bi-Directional algorithm up to and
		  including step L1). This populates the
		  <structname>unicode_bidi_level_t</structname> buffer.
		</para>
	      </listitem>

	      <listitem>
		<para>
		  Alternatively: allocate only the
		  <structname>unicode_bidi_level_t</structname> array
		  and use <function>unicode_bidi_calc</function>(), which
		  <function>malloc</function>()s the
		  <structname>unicode_bidi_type_t</structname> buffer,
		  calls <function>unicode_bidi_calc_levels</function>(),
		  and then <function>free</function>()s the buffer.
		</para>
	      </listitem>

	      <listitem>
		<para>
		  Use <function>unicode_bidi_reorder</function>() to reverse
		  any characters in the string, according to the
		  algorithm (step L2), with an optional
		  callback that reports which ranges of characters get
		  reversed.
		</para>
	      </listitem>
	      <listitem>
		<para>
		  Use <function>unicode_bidi_cleanup</function>()
		  to remove the characters from the string which are used
		  by the bi-directional algorithm, and are not needed for
		  rendering the text.
		  <function>unicode_bidi_cleaned_size</function>() is
		  available to determine, in advance, how many characters
		  will remain.
		</para>
	      </listitem>
	    </orderedlist>

	    <para>
	      The parameters to
	      <function>unicode_bidi_calc_types</function>() are:
	    </para>

	    <itemizedlist>
	      <listitem>
		<para>
		  A pointer to the Unicode string.
		</para>
	      </listitem>
	      <listitem>
		<para>
		  Number of characters in the Unicode string.
		</para>
	      </listitem>
	      <listitem>
		<para>
		  A pointer to an array of
		  <structname>unicode_bidi_type_t</structname> values.
		  The caller is
		  responsible for allocating and deallocating this array,
		  which has the same size as the Unicode string.
		</para>
	      </listitem>
	    </itemizedlist>

	    <para>
	      The parameters to
	      <function>unicode_bidi_calc_levels</function>() are:
	    </para>

	    <itemizedlist>
	      <listitem>
		<para>
		  A pointer to the Unicode string.
		</para>
	      </listitem>

	      <listitem>
		<para>
		  A pointer to the buffer that was passed to
		  <function>unicode_bidi_calc_types</function>().
		</para>
	      </listitem>

	      <listitem>
		<para>
		  Number of characters in the Unicode string and the
		  <structname>unicode_bidi_type_t</structname> buffer.
		</para>
	      </listitem>
	      <listitem>
		<para>
		  A pointer to an array of
		  <structname>unicode_bidi_level_t</structname> values.
		  The caller is
		  responsible for allocating and deallocating this array,
		  which has the same size as the Unicode string.
		</para>
	      </listitem>
	      <listitem>
		<para>
		  An optional pointer to a
		  <literal>UNICODE_BIDI_LR</literal> or
		  <literal>UNICODE_BIDI_RL</literal> value. This sets
		  the default paragraph direction level.
		  A null pointer computes the default paragraph direction
		  level based on the string, as specified by the "P" rules
		  of the bi-directional algorithm.
		</para>
	      </listitem>
	    </itemizedlist>

	    <para>
	      The parameters to <function>unicode_bidi_calc</function>() are
	      the same except for the
	      <structname>unicode_bidi_type_t</structname> pointer.
	      <function>unicode_bidi_calc</function>() allocates this
	      buffer by itself and calls
	      <function>unicode_bidi_calc_types</function>, and
	      destroys the buffer before returning.
	    </para>

	    <para>
	      <function>unicode_bidi_calc</function>()
	      and <function>unicode_bidi_calc_levels</function>() fill in the
	      <structname>unicode_bidi_level_t</structname> array with the
	      values corresponding to the embedding level of the
	      corresponding character,
	      according the Unicode Bidirection Algorithm (even values for
	      left-to-right ordering, and odd values for right-to-left
	      ordering).
	      A value of UNICODE_BIDI_SKIP designates directional markers
	      (from step X9).
	    </para>

	    <para>
	      <function>unicode_bidi_calc</function>()
	      and <function>unicode_bidi_calc_levels</function>()
	      return the resolved
	      paragraph direction level, which
	      always matches the passed in level, if specified, else it
	      reports the derived one. These functions return a
	      <structname>unicode_bidi_direction</structname> structure:
	    </para>

	    <informaltable border='0'>
	      <tgroup cols="3">
		<colspec colname='c1' />
		<colspec colname='c2' />
		<colspec colname='c3' />
		<tbody>
		  <row>
		    <entry namest='c1' nameend='c3'>struct&nbsp;<structname>unicode_bidi_direction</structname>&nbsp;{</entry>
		  </row>
		  <row>
		    <entry></entry>
		    <entry>unicode_bidi_level_t</entry>
		    <entry><varname>direction</varname>;</entry>
		  </row>
		  <row>
		    <entry></entry>
		    <entry>int</entry>
		    <entry><varname>is_explicit</varname>;</entry>
		  </row>
		  <row>
		    <entry namest='c1' nameend='c3'>};</entry>
		  </row>
		</tbody>
	      </tgroup>
	    </informaltable>
	    <para>
	      <varname>direction</varname> gives the paragraph embedding
	      level, <literal>UNICODE_BIDI_LR</literal> or
	      <literal> UNICODE_BIDI_RL</literal>.
	      <varname>is_explicit</varname> indicates whether:
	      the optional pointer to a
	      <literal>UNICODE_BIDI_LR</literal> or
	      <literal>UNICODE_BIDI_RL</literal> value was specified (and
	      returned in <varname>direction</varname>), or whether the
	      <varname>direction</varname> comes from an character with an
	      explicit direction indication.
	    </para>

	    <para>
	      <function>unicode_bidi_reorder</function>() takes the actual
	      unicode string together with the embedding values from
	      <function>unicode_bidi_calc</function> or
	      <function>unicode_bidi_calc_levels</function>(), then reverses the
	      bi-directional string, as specified by step L2 of the bi-directional
	      algorithm.
	      The parameters to
	      <function>unicode_bidi_reorder</function>() are:
	    </para>
	    <itemizedlist>
	      <listitem>
		<para>
		  A pointer to the Unicode string.
		</para>
	      </listitem>
	      <listitem>
		<para>
		  A pointer to an array of
		  <structname>unicode_bidi_level_t</structname> values.
		</para>
	      </listitem>
	      <listitem>
		<para>
		  Number of characters in the Unicode string and the
		  <structname>unicode_bidi_level_t</structname> array.
		</para>
	      </listitem>

	      <listitem>
		<para>
		  An optional <varname>reorder_callback</varname> function
		  pointer.
		</para>
	      </listitem>
	    </itemizedlist>
	    <para>
	      A non-<literal>NULL</literal>
	      <parameter>reorder_callback</parameter> gets invoked to report
	      each reversed character range. The callback's first parameter
	      is the index of the first reversed character, the second parameter
	      is the number of reversed characters, starting at the given
	      index of the Unicode string.
	      The third parameter is the <parameter>arg</parameter> passthrough
	      parameter.
	    </para>

	    <para>
	      <function>unicode_bidi_reorder</function> modifies its
	      <parameter>string</parameter> and <parameter>levels</parameter>.
	      <parameter>reorder_callback</parameter> gets invoked after
	      reversing each consecutive range of values in the
	      <parameter>string</parameter> and <parameter>levels</parameter>
	      buffers. For example: <quote>reorder_callback(5, 7, arg)</quote>
	      reports that character indexes #5 through #11 got reversed.
	    </para>

	    <para>
	      A NULL <parameter>string</parameter> pointer leaves the
	      <parameter>levels</parameter> buffer unchanged, but still
	      invokes the <parameter>reorder_callback</parameter> as if
	      the character string, and their embedding values, were reversed.
	    </para>

	    <para>
	      The resulting string and embedding levels are in
	      <quote>rendering order</quote>, but still contain bi-directional
	      embedding, override, boundary-neutral, isolate, and marker
	      characters.
	      <function>unicode_bidi_cleanup</function>
	      removes these characters and directional markers.
	    </para>
	    <para>
	      The parameters to <function>unicode_bidi_cleanup</function>()
	      are:
            </para>

	    <itemizedlist>
	      <listitem>
		<para>
		  The pointer to the unicode string.
                </para>
              </listitem>
	      <listitem>
		<para>
		  A non-null pointer to the directional embedding level buffer,
		  of the same size as the string, also removes the corresponding
		  values from the buffer, and the remaining values in the
		  embedding level buffer get reset to
		  levels <literal>UNICODE_BIDI_LR</literal> and
		  <literal> UNICODE_BIDI_RL</literal>, only.
		</para>
              </listitem>

	      <listitem>
		<para>
		  The size of the unicode string and the directional embedding
		  buffer (if not NULL).
                </para>
              </listitem>

	      <listitem>
		<para>
		  A a bitmask that selects the following options
		  (or 0 if no options):
		</para>

		<variablelist>
		  <varlistentry>
		    <term><literal>UNICODE_BIDI_CLEANUP_EXTRA</literal></term>
		    <listitem>
		      <para>
			In addition to removing all embedding, override, and
			boundry-neutral characters as
			specified by step X9 of the bi-directional algorithm
			(the default behavior without this flag), also
			remove all isolation markers and implicit markers.
		      </para>
		    </listitem>
		  </varlistentry>

		  <varlistentry>
		    <term><literal>UNICODE_BIDI_CLEANUP_BNL</literal></term>
		    <listitem>
		      <para>
			Replace all characters classified as paragraph
			separators with a newline character.
		      </para>
		    </listitem>
		  </varlistentry>

		  <varlistentry>
		    <term><literal>UNICODE_BIDI_CLEANUP_CANONICAL</literal></term>
		    <listitem>
		      <para>
			A combined set of
			<literal>UNICODE_BIDI_CLEANUP_EXTRA</literal>
			and
			<literal>UNICODE_BIDI_CLEANUP_BNL</literal>,
		      </para>
		    </listitem>
		  </varlistentry>
		</variablelist>
	      </listitem>

	      <listitem>
		<para>
		  A pointer to a function that gets repeatedly invoked with the
		  index of the character that gets removed from the Unicode
		  string.
                </para>
              </listitem>
	      <listitem>
		<para>
		  An opaque pointer that gets forwarded to the callback.
                </para>
              </listitem>
            </itemizedlist>
	    <para>
	      The function pointer (if not <literal>NULL</literal>)
	      gets invoked to report the index of each
	      removed character. The reported index is the index from the
	      original string, and the callback gets invoked in strict order,
	      from the first to
	      the last removed character (if any).
            </para>

	    <para>
	      The character string and the embedding level values resulting
	      from <function>unicode_bidi_cleanup</function>()
	      with the <literal>UNICODE_BIDI_CLEANUP_CANONICAL</literal>
	      are in
	      <quote>canonical rendering order</quote>.
	      <function>unicode_bidi_logical_order</function>(),
	      <function>unicode_bidi_needs_embed</function>() and
	      <function>unicode_bidi_embed</function>() require the
	      canonical rendering order for their string and embedding level
	      values.
            </para>
	    <para>
	      The parameters to <function>unicode_bidi_cleaned_size</function>()
	      are a pointer to the unicode string, its size, and
	      the bitmask option to <function>unicode_bidi_cleanup</function>().
            </para>
	  </refsect2>

	  <refsect2 id="unicode_bidi_embed">
	    <title>Embedding bi-directional markers in Unicode text strings</title>
            <para>
	      <function>unicode_bidi_logical_order</function>() rearranges
	      the string from rendering to its logical order.
	      <function>unicode_bidi_embed</function>() adds various
	      bi-directional markers to a Unicode string in canonical rendering
	      order. The resulting string is not guaranteed to be
	      identical to the
	      original Unicode bi-directional string. The algorithm is fairly
	      basic,
	      but the resulting bi-directional string produces the same
	      canonical rendering order after applying
	      <function>unicode_bidi_calc()</function> or
	      <function>unicode_bidi_calc_levels</function>(),
	      <function>unicode_reorder()</function> and
	      <function>unicode_bidi_cleanup()</function>
	      (with the canonical option),
	      with the same paragraph_embedding level.
	      <function>unicode_bidi_needs_embed</function>() attempts to
	      heuristically determine whether
	      <function>unicode_bidi_embed</function>() is required.
            </para>

	    <para>
	      <function>unicode_bidi_logical_order</function>() gets called
	      first, followed by
	      <function>unicode_bidi_embed</function>()
	      (or
	      <function>unicode_bidi_needs_embed</function>() in order to
	      determine whether bi-directional markers are required).
	      Finally, <function>unicode_bidi_embed_paragraph_level</function>()
	      optionally determines whether the resulting string's default
	      paragraph embedding level matches the one used for the actual
	      embedding direction, and if not returns a directional marker
	      to be prepended to the Unicode character string, as a hint.
            </para>
	    <para>
	      <function>unicode_bidi_logical_order</function>() factors in the
	      characters' embedding values, and the provided paragraph
	      embedding value
	      (<literal>UNICODE_BIDI_LR</literal> or
	      <literal>UNICODE_BIDI_RL</literal>), and rearranges the characters
	      and the embedding levels in left-to-right order, while
	      simultaneously
	      invoking the supplied reorder_callback indicating each range of
	      characters whose relative order gets reversed. The
	      <function>reorder_callback</function>() receives, as
	      parameters:
            </para>
	    <itemizedlist>
	      <listitem>
		<para>
		  The starting index of the first reversed character, in the
		  string.
                </para>
              </listitem>
	      <listitem>
		<para>
		  Number of reversed characters.
                </para>
              </listitem>
	      <listitem>
		<para>
		  Forwarded <parameter>arg</parameter> pointer value.
                </para>
              </listitem>
            </itemizedlist>
	    <para>
	      This specifies a consecutive range of characters (and
	      directional  embedding values)
	      that get reversed (first character in the range becomes the
	      last character,
	      and the last character becomes the first character).
            </para>

	    <para>
	      After
	      <function>unicode_bidi_logical_order</function>(),
	      <function>unicode_bidi_embed</function>() progressively invokes
	      the passed-in callback with
	      the contents of a bi-directional unicode string.
	      The parameters to <function>unicode_bidi_embed</function>() are:
            </para>
            <itemizedlist>
	      <listitem>
		<para>
		  The Unicode string.
                </para>
              </listitem>
	      <listitem>
		<para>
		  The directional embedding buffer, in canonical
		  rendering order.
                </para>
              </listitem>
	      <listitem>
		<para>
		  The size of the string and the embedding level buffer.
                </para>
              </listitem>
	      <listitem>
		<para>
		  The paragraph embedding level, either
		  <literal>UNICODE_BIDI_LR</literal> or
		  <literal>UNICODE_BIDI_RL</literal>.
                </para>
              </listitem>
	      <listitem>
		<para>
		  The pointer to the callback function.
                </para>
              </listitem>
	      <listitem>
		<para>
		  An opaque pointer argument that gets forwarded to the
		  callback function.
                </para>
              </listitem>
            </itemizedlist>
	    <para>
	      The callback receives pointers to
	      various parts of the original string that gets passed to
	      <function>unicode_bidi_embed</function>(), intermixed with
	      bi-directional markers,
	      overrides, and isolates. The callback's parameters are:
            </para>

            <itemizedlist>
	      <listitem>
		<para>
		  The pointer to a Unicode string.
                </para>
		<note>
		  <para>
		    It is not a given that the callback receives pointers
		    to progressively increasing pointers of the original
		    string that gets passed to
		    <function>unicode_bidi_embed</function>().
		    Some calls will be for individual bi-directional
		    markers, and
		    <function>unicode_bidi_embed</function>() also
		    performs some additional internal reordering, on the fly,
		    after <function>unicode_bidi_logical_order</function>()'s
		    big hammer.
                  </para>
                </note>
              </listitem>
	      <listitem>
		<para>
		  Number of characters in the Unicode string.
                </para>
              </listitem>
	      <listitem>
		<para>
		  Indication whether the Unicode string pointer is pointing
		  to a part of the original Unicode string that's getting
		  embedded. Otherwise this must be some marker character that's
		  not present in the original Unicode string.
		</para>
	      </listitem>
	      <listitem>
		<para>
		  Forwarded <parameter>arg</parameter> pointer value.
                </para>
              </listitem>
            </itemizedlist>

	    <para>
	      The assembled unicode string should produce the same
	      canonical rendering order, for the same paragraph embedding
	      level.
	      <function>unicode_bidi_embed_paragraph_level</function>()
	      checks if the specified Unicode string computes the given
	      default paragraph embedding level and returns 0 if it matches.
	      Otherwise it returns a directional marker that should be
	      <emphasis>prepended</emphasis> to the Unicode string to allow
	      <function>unicode_bidi_calc</function>'s
	      (or <function>unicode_bidi_calc_levels</function>())
	      optional paragraph
	      embedding level pointer's value to be <literal>NULL</literal>,
	      but derive the same default embedding level.
	      The parameters to
	      <function>unicode_bidi_embed_paragraph_level</function>() are:
            </para>
            <itemizedlist>
	      <listitem>
		<para>
		  The Unicode string.
                </para>
              </listitem>
	      <listitem>
		<para>
		  The size of the string.
                </para>
              </listitem>
	      <listitem>
		<para>
		  The paragraph embedding level, either
		  <literal>UNICODE_BIDI_LR</literal> or
		  <literal>UNICODE_BIDI_RL</literal>.
                </para>
              </listitem>
	    </itemizedlist>

	    <para>
	      <function>unicode_bidi_needs_embed</function>() attempts to
	      heuristically determine whether the Unicode string, in logical
	      order, requires bi-directional markers.
	      The parameters to
	      <function>unicode_bidi_embed_paragraph_level</function>() are:
	    </para>
	    <itemizedlist>
	      <listitem>
		<para>
		  The Unicode string.
                </para>
              </listitem>
	      <listitem>
		<para>
		  The directional embedding buffer, in logical order.
                </para>
              </listitem>
	      <listitem>
		<para>
		  The size of the string and the embedding level buffer.
                </para>
              </listitem>
	      <listitem>
		<para>
		  A pointer to an explicit paragraph embedding level, either
		  <literal>UNICODE_BIDI_LR</literal> or
		  <literal>UNICODE_BIDI_RL</literal>; or a
		  <literal>NULL</literal> pointer (see
		  <function>unicode_bidi_calc_types</function>()'s
		  explanation for this parameter).
                </para>
              </listitem>
	    </itemizedlist>

	    <para>
	      <function>unicode_bidi_needs_embed</function>() returns 0
	      if the Unicode string does not need explicit directional
	      markers, or 1 if it does. This is done by using
	      <function>unicode_bidi_calc()</function>,
	      <function>unicode_bidi_reorder()</function>,
	      <function>unicode_bidi_logical_order</function> and then
	      checking if the end result is different from what was passed
	      in.
	    </para>
          </refsect2>
	  <refsect2 id="unicode_bidi_combinings">
	    <title>Combining character ranges</title>

	    <para>
	      <function>unicode_bidi_combinings</function>() reports
	      consecutive sequences of one or more combining marks
	      in bidirectional text (which can be either in rendering or
	      logical order) that have the same embedding level. It takes
	      the following parameters:
	    </para>

	    <itemizedlist>
	      <listitem>
		<para>The Unicode string.</para>
	      </listitem>
	      <listitem>
		<para>
		  The directional embedding buffer, in logical
		  or rendering order. A <literal>NULL</literal> value for
		  this pointer is equivalent to a directional embedding
		  buffer with a level of 0 for every character in the Unicode
		  string.
                </para>
              </listitem>

	      <listitem>
		<para>
		  Number of characters in the Unicode string.
                </para>
              </listitem>

	      <listitem>
		<para>
		  The pointer to the callback function.
		</para>
	      </listitem>

	      <listitem>
		<para>
		  An opaque pointer argument that gets forwarded to the
		  callback function.
                </para>
              </listitem>
            </itemizedlist>

	    <para>
	      The callback function gets invoked for every consecutive
	      sequence of one or more characters that have a canonical
	      combining class other than 0, and with the same
	      embedding level. The parameters to the callback function are:
	    </para>

	    <itemizedlist>
	      <listitem>
		<para>The embedding level of the combining characters.</para>
	      </listitem>
	      <listitem>
		<para>
		  The starting index of a consecutive sequence of all
		  characters with the same embedding level.
		</para>
	      </listitem>
	      <listitem>
		<para>
		  The number of characters with the same embedding level.
		</para>
	      </listitem>

	      <listitem>
		<para>
		  The starting index of a consecutive sequence of all
		  characters with the same embedding level
		  and a canonical combining
		  class other than 0. This will always be equal to or greater
		  than the value of the second parameter.
		</para>
	      </listitem>

	      <listitem>
		<para>
		  The number of consecutive characters with the
		  characters with the same embedding level
		  and a canonical combining class other than 0.
		  The last character included in this sequence will always
		  be less than or equal to the last character in the sequence
		  defined by the second and the third parameters.
		</para>
	      </listitem>
	      <listitem>
		<para>
		  The opaque pointer argument that was passed to
		  <function>unicode_bidi_combinings</function>.
                </para>
              </listitem>
	    </itemizedlist>

	    <para>
	      A consecutive sequence of Unicode characters with non-0 combining
	      classes but different embedding levels gets reported individually,
	      for each consecutive sequence with the same embedding level.
	    </para>

	    <para>
	      This function helps with reordering the combining characters in
	      right-to-left-rendered text.
	      Right-to-left text reversed by
	      <function>unicode_bidi_reorder</function>() results in combining
	      characters preceding their starter character. They get reversed
	      no differently than any other character.
	      The same thing also occurs after
	      <function>unicode_bidi_logical_order</function>() reverses
	      everything back.
	      Use <function>unicode_bidi_combinings</function> to identify
	      consecutive sequences of combining characters followed by their
	      original starter.
	    </para>

	    <para>
	      The callback may reorder the characters identified
	      by its third and the fourth parameters
	      in the manner described below.
	      <function>unicode_bidi_reorder</function>'s parameter is
	      pointers to a constant Unicode string; but it can modify the
	      string (via an out-of-band mutable pointer) subject to the
	      following conditions:
	    </para>

	    <itemizedlist>
	      <listitem>
		<para>
		  The characters identified by the third and the fourth
		  parameter may be modified.
		</para>
	      </listitem>

	      <listitem>
		<para>
		  If the last character in this sequence is not the last
		  character included in the range specified by the first
		  and the second character, then one more character after
		  the last character may also be modified.
		</para>

		<para>
		  This is, presumably, the original starter that preceded
		  the combining characters before the entire sequence was
		  reversed.
		</para>
	      </listitem>
	    </itemizedlist>

	    <para>
	      Here's an example of a callback that reverses
	      combining characters and their immediately-following starter
	      character:
	    </para>
	    <blockquote>
	      <informalexample>
		<programlisting><![CDATA[
void reorder_right_to_left_combining(unicode_bidi_level_t level,
                                     size_t level_start,
                                     size_t n_chars,
                                     size_t comb_start,
                                     size_t n_comb_chars,
                                     void *arg)
{
    /* Let's say that this is the Unicode string */
    char32_t *buf=(char32_t *)arg;

    if ((level & 1) == 0)
        return; /* Left-to-right text not reversed */

    char32_t *b=buf+comb_start;
    char32_t *e=b+n_comb_chars;

    /*
    ** Include the starter characters in the reversed range.
    ** The semantics of the combining characters with different
    ** embedding levels -- so they get reported here separately -- is
    ** not specified. This will reverse just the combining marks, and
    ** they're on their own.
    */

    if (comb_start + n_comb_chars < level_start + n_chars)
        ++e;

    while (b < e)
    {
        char32_t t;

        --e;
        t=*b;
        *b=*e;
        *e=t;
        ++b;
    }
}]]></programlisting>
	      </informalexample>
	    </blockquote>
	  </refsect2>
	  <refsect2 id="unicode_bidi_misc">
	    <title>Miscellaneous utility functions</title>

	    <para>
	      <function>unicode_bidi_get_direction</function>
	      takes a pointer to a unicode string, the number of
	      characters in the unicode string, and determines
	      default paragraph level level.
	      <function>unicode_bidi_get_direction</function> returns
	      a <literal>struct</literal> with the following fields:
	    </para>
	    <variablelist>
	      <varlistentry>
		<term><varname>direction</varname></term>
		<listitem>
		  <para>
		    This value is either <literal>UNICODE_BIDI_LR</literal>
		    or <literal>UNICODE_BIDI_RL</literal> (left to right or
		    right to left).
		  </para>
		</listitem>
	      </varlistentry>

	      <varlistentry>
		<term><varname>is_explicit</varname></term>
		<listitem>
		  <para>
		    This value is a flag. A non-0 value indicates that
		    the embedding level was derived from an explicit
		    character type (<literal>L</literal>, <literal>R</literal>
		    or <literal>AL</literal>) from the stirng. A 0 value
		    indicates the default paragraph direction, no explicit
		    character was found in the string.
		  </para>
		</listitem>
	      </varlistentry>
	    </variablelist>
	    <para>
	      <function>unicode_bidi_type</function>
	      looks up each character's bi-directional character type.
	    </para>

	    <para>
	      <function>unicode_bidi_setbnl</function>
	      takes a pointer to a unicode string, a pointer to an
	      array of <classname>enum_bidi_type_t</classname> values and
	      the number of characters in the string and the array.
	      <function>unicode_bidi_setbnl</function> replaces all
	      paragraph separators in the unicode string with a newline
	      character (same as the <literal>UNICODE_BIDI_CLEANUP_BNL</literal>
	      option to <function>unicode_bidi_cleanup</function>.
	    </para>

	    <para>
	      <function>unicode_bidi_mirror</function>
	      returns the glyph that's a mirror image of the parameter
	      (i.e. an open parenthesis for a close parenthesis, and vice
	      versa); or the same value if there is no mirror image
	      (this is the <literal>Bidi_Mirrored=Yes</literal> property).
	    </para>

	    <para>
	      <function>unicode_bidi_bracket_type</function>
	      looks up each bracket character and returns its opposite, or
	      the same value if the character is not a bracket that has an
	      opposing bracket character
	      (this is the <literal>Bidi_Paired_Bracket_type</literal>
	      property).
	      A non-NULL <parameter>ret</parameter> gets initialized to
	      either <literal>UNICODE_BIDI_o</literal>,
	      <literal>UNICODE_BIDI_c</literal> or
	      <literal>UNICODE_BIDI_n</literal>.
	    </para>
	  </refsect2>
	</refsect1>
	<refsect1 id="courier_unicode_bidi_seealso">
	  <title>SEE ALSO</title>
	  <para>
	    <ulink url="https://www.unicode.org/reports/tr9/tr9-&tr9ver;.html">TR-9</ulink>,
	    <link linkend="unicode__bidi">
	      <citerefentry><refentrytitle>unicode::bidi</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	    <link linkend="courier-unicode">
	      <citerefentry>
		<refentrytitle>courier-unicode</refentrytitle>
		<manvolnum>7</manvolnum></citerefentry></link>,
	  </para>
	</refsect1>
      </refentry>

      <refentry id="unicode_canonical">
	<refentryinfo><author><firstname>Sam</firstname><surname>Varshavchik</surname><contrib>Author</contrib></author><productname>Courier Unicode Library</productname></refentryinfo>

	<refmeta>
	  <refentrytitle>unicode_canonical</refentrytitle>
	  <manvolnum>3</manvolnum>
	</refmeta>

	<refnamediv>
	  <refname>unicode_canonical</refname>
	  <refname>unicode_ccc</refname>
	  <refname>unicode_decomposition_init</refname>
	  <refname>unicode_decomposition_deinit</refname>
	  <refname>unicode_decompose</refname>
	  <refname>unicode_decompose_reallocate_size</refname>
	  <refname>unicode_compose</refname>
	  <refname>unicode_composition_init</refname>
	  <refname>unicode_composition_deinit</refname>
	  <refname>unicode_composition_apply</refname>

	  <refpurpose>unicode canonical normalization and denormalization</refpurpose>
	</refnamediv>

	<refsynopsisdiv>
	  <funcsynopsis>
	    <funcsynopsisinfo>#include &lt;courier-unicode.h&gt;</funcsynopsisinfo>
	    <funcprototype>
	      <funcdef>unicode_canonical_t <function>unicode_canonical</function></funcdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>uint8_t <function>unicode_ccc</function></funcdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>void <function>unicode_decomposition_init</function></funcdef>
	      <paramdef>unicode_decomposition_t *<parameter>info</parameter></paramdef>
	      <paramdef>char32_t *<parameter>string</parameter></paramdef>
	      <paramdef>size_t *<parameter>string_size</parameter></paramdef>
	      <paramdef>void *<parameter>arg</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>int <function>unicode_decompose</function></funcdef>
	      <paramdef>unicode_decomposition_t *<parameter>info</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>void <function>unicode_decomposition_deinit</function></funcdef>
	      <paramdef>unicode_decomposition_t *<parameter>info</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>size_t <function>unicode_decompose_reallocate_size</function></funcdef>
	      <paramdef>unicode_decomposition_t *<parameter>info</parameter></paramdef>
	      <paramdef>const size_t *<parameter>sizes</parameter></paramdef>
	      <paramdef>size_t <parameter>n</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>int <function>unicode_compose</function></funcdef>
	      <paramdef>char32_t *<parameter>string</parameter></paramdef>
	      <paramdef>size_t <parameter>string_size</parameter></paramdef>
	      <paramdef>int <parameter>flags</parameter></paramdef>
	      <paramdef>size_t *<parameter>new_size</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>int <funcname>unicode_composition_init</funcname></funcdef>
	      <paramdef>const char32_t *<parameter>string</parameter></paramdef>
	      <paramdef>size_t <parameter>string_size</parameter></paramdef>
	      <paramdef>int <parameter>flags</parameter></paramdef>
	      <paramdef>unicode_composition_t *<parameter>compositions</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>void <function>unicode_composition_deinit</function></funcdef>
	      <paramdef>unicode_composition_t *<parameter>compositions</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>size_t <function>unicode_composition_apply</function></funcdef>
	      <paramdef>char32_t *<parameter>string</parameter></paramdef>
	      <paramdef>size_t <parameter>string_size</parameter></paramdef>
	      <paramdef>unicode_composition_t *<parameter>compositions</parameter></paramdef>
	    </funcprototype>
	  </funcsynopsis>
	</refsynopsisdiv>
	<refsect1 id="unicode_canonical_descr">
	  <title>DESCRIPTION</title>

	  <para>
	    These functions compose or decompose a Unicode string into a
	    canonical or a compatible normalized form.
	  </para>

	  <para>
	    <function>unicode_canonical</function>() looks up the
	    character's
	    <ulink url="https://www.unicode.org/reports/tr15/tr15-&tr15ver;.html
">canonical
	    and compatibility mapping</ulink>.

	    <function>unicode_canonical</function>() returns a structure
	    with the following fields:
	  </para>

	  <variablelist>
	    <varlistentry>
	      <term><structfield>canonical_chars</structfield></term>
	      <listitem>
		<para>
		  A pointer to the canonical or equivalent representation
		  of the character.
	        </para>
	      </listitem>
	    </varlistentry>
	    <varlistentry>
	      <term><structfield>n_canonical_chars</structfield></term>
	      <listitem>
		<para>
		  Number of characters in the
		  <structfield>canonical_chars</structfield>.
	        </para>
	      </listitem>
	    </varlistentry>
	    <varlistentry>
	      <term><structfield>format</structfield></term>
	      <listitem>
		<para>
		  A value of <literal>UNICODE_CANONICAL_FMT_NONE</literal>
		  indicates a canonical mapping, other values indicate
		  a compatibility equivalent mapping.
	        </para>
	      </listitem>
	    </varlistentry>
	  </variablelist>

	  <para>
	    A NULL <structfield>canonical_chars</structfield> (with a 0
	    <structfield>n_canonical_chars</structfield>) indicates
	    that the character has no canonical or compatibility
	    equivalence.
	  </para>

	  <para>
	    <function>unicode_ccc</function>() returns the character's
	    canonical combining class value.
	  </para>

	  <para>
	    <function>unicode_decomposition_init</function>(),
	    <function>unicode_decompose</function>()
	    and <function>unicode_decomposition_deinit</function>()
	    implement a complete interface for decomposing a
	    Unicode string:
	  </para>

	  <blockquote>
	    <informalexample>
	      <programlisting><![CDATA[
unicode_decomposition_t info;

unicode_decomposition_init(&info, before, (size_t)-1, NULL);
info.decompose_flags=UNICODE_DECOMPOSE_FLAG_QC;
unicode_decompose(&info);
unicode_decomposition_deinit(&info);]]></programlisting>
	    </informalexample>
	  </blockquote>

	  <para>
	    <function>unicode_decomposition_init</function>() initializes
	    a new <classname>unicode_decomposition_t</classname> structure,
	    that gets passed in as its first parameter.
	    The second parameter is a pointer to a Unicode string,
	    with the number of characters in the string in the third parameter.
	    A string size
	    of <literal>-1</literal> indicates a
	    <literal>\0</literal>-terminated string and calculates its
	    <varname>string_size</varname> (which does not include the
	    trailing <literal>\0</literal>.
	    The last parameter is a <literal>void *</literal>, an opaque
	    pointer that gets stored in the initialized
	    <classname>unicode_decomposition_t</classname> object:
	  </para>
	  <blockquote>
	    <informaltable border='0' colsep='0'>
	      <tgroup cols="3">
		<colspec colname='c1' />
		<colspec colname='c2' />
		<colspec colname='c3' />
		<colspec colname='c4' />
		<colspec colname='c5' />
		<tbody>
		  <row>
		    <entry namest='c1' nameend='c5'>typedef struct&nbsp;<structname>unicode_decomposition</structname>&nbsp;{</entry>
		  </row>
		  <row>
		    <entry namest='c2'>char32_t</entry>
		    <entry namest='c3' nameend='c5'>*<varname>string</varname>;</entry>
		  </row>
		  <row>
		    <entry namest='c2'>size_t</entry>
		    <entry namest='c3' nameend='c5'><varname>string_size</varname>;</entry>
		  </row>
		  <row>
		    <entry namest='c2'>int</entry>
		    <entry namest='c3' nameend='c5'><varname>decompose_flags</varname>;</entry>
		  </row>
		  <row>
		    <entry namest='c2'>int</entry>
		    <entry namest='c3' nameend='c5'>(*<varname>reallocate)(</varname></entry>
		  </row>
		  <row>
		    <entry namest='c4'>struct&#160;unicode_decomposition</entry>
		    <entry>*<varname>info</varname>,</entry>
		  </row>
		  <row>
		    <entry namest='c4'>const&#160;size_t</entry>
		    <entry>*<varname>offsets</varname>,</entry>
		  </row>
		  <row>
		    <entry namest='c4'>const&#160;size_t</entry>
		    <entry>*<varname>sizes</varname>,</entry>
		  </row>
		  <row>
		    <entry namest='c4'>size_t</entry>
		    <entry><varname>n</varname></entry>
		  </row>
		  <row>
		    <entry namest='c3' align='right'>);</entry>
		  </row>
		  <row>
		    <entry namest='c2'>void</entry>
		    <entry namest='c3' nameend='c5'>*<varname>arg</varname>;</entry>
		    </row>q
		    <row>
		      <entry namest='c1' nameend='c5'>} unicode_decomposition_t;</entry>
		    </row>
		</tbody>
	      </tgroup>
	    </informaltable>
	  </blockquote>

	  <para>
	    <function>unicode_decompose</function>() proceeds and decomposes
	    the <varname>string</varname> and replaces it with its
	    decomposed <varname>string</varname> version.
	  </para>

	  <para>
	    <classname>unicode_decomposition_t</classname>'s
	    <varname>string</varname>,
	    <varname>string_size</varname> and
	    <varname>arg</varname> are copies of
	    <function>unicode_decomposition_init</function>'s parameters.
	    <function>unicode_decomposition_init</function>
	    initializes all other fields to their default values.
	  </para>

	  <para>
	    The <varname>decompose_flags</varname> bitmask gets initialized to
	    0, and is a bit mask:
	  </para>

	  <variablelist>
	    <varlistentry>
	      <term><literal>UNICODE_DECOMPOSE_FLAG_QC</literal></term>
	      <listitem>
		<para>
		  Check each character's appropriate
		  <quote>quick check</quote> property
		  and skip decomposing Unicode characters that would
		  get re-composed by
		  <function>unicode_composition_apply</function>().
		</para>
	      </listitem>
	    </varlistentry>
	    <varlistentry>
	      <term><literal>UNICODE_DECOMPOSE_FLAG_COMPAT</literal></term>
	      <listitem>
		<para>
		  Perform a compatibility decomposition instead of a
		  canonical decomposition.
		</para>
	      </listitem>
	    </varlistentry>
	  </variablelist>

	  <para>
	    <varname>reallocate</varname> is a pointer to a function that
	    gets called to reallocate a larger <varname>string</varname>.
	    <function>unicode_decompose</function>() determines which characters
	    in the <varname>string</varname> need decomposing and calls
	    the <varname>reallocate</varname> function pointer
	    zero or more times.
	    Each call to <varname>reallocate</varname> passes information
	    about where new characters will get inserted into the
	    <varname>string</varname>.
	  </para>

	  <para>
	    <varname>reallocate</varname> only needs to grow the size of the
	    buffer where
	    <varname>string</varname> points so that it's big enough to hold
	    a larger, decomposed string; then update
	    <varname>string</varname> accordingly.
	    <varname>reallocate</varname> should not update
	    <varname>string_size</varname> or make any changes to the existing
	    <varname>string</varname>, that's
	    <function>unicode_decompose</function>()'s job
	    (after <varname>reallocate</varname> returns).
	  </para>

	  <para>
	    The <varname>reallocate</varname> callback function receives
	    the following parameters.
	  </para>

	  <itemizedlist>
	    <listitem>
	      <para>
		A pointer to the
		<classname>unicode_decomposition_t</classname> and, notably,
		its <varname>arg</varname>.
	      </para>
	    </listitem>

	    <listitem>
	      <para>
		A pointer to the array of offset indexes in the
		<varname>string</varname> where new characters will get
		inserted in order to hold the decomposed string.
	      </para>
	    </listitem>

	    <listitem>
	      <para>
		A pointer to the array that holds the number of characters
		that get inserted each corresponding offset.
	      </para>
	    </listitem>

	    <listitem>
	      <para>
		The size of the two arrays.
	      </para>
	    </listitem>
	  </itemizedlist>
	  <para>
	    <varname>reallocate</varname> must update the
	    <varname>string</varname> if necessary to hold at least
	    the number of characters that's the sum total of the
	    initial <varname>string_size</varname> and the sum total of al
	    <varname>sizes</varname>.
	  </para>

	  <para>
	    <function>unicode_decomposition_init</function>() initializes
	    the <varname>reallocate</varname> pointer to a default
	    implementation that uses
	    <citerefentry>
	      <refentrytitle>realloc</refentrytitle>
	      <manvolnum>3</manvolnum>
	    </citerefentry>
	    and updates <varname>string</varname> with its return value.
	    The application can use its own
	    <varname>reallocate</varname> to handle this task on its own,
	    and use <function>unicode_decompose_reallocate_size</function>
	    to compute the minimum string size:
	  </para>

	  <blockquote>
	    <informalexample>
	      <programlisting><![CDATA[
size_t unicode_decompose_reallocate_size(unicode_decomposition_t *info,
                                         const size_t *sizes,
                                         size_t n)
{
    size_t i;
    size_t new_size=info->string_size;

    for (i=0; i<n; ++i)
        new_size += sizes[i];

    return new_size;
}]]>
	      </programlisting>
	    </informalexample>
	  </blockquote>

	  <para>
	    The <varname>reallocate</varname> function
	    returns 0 on success and
	    a non-0 error code to report a failure; and
	    <varname>unicode_decompose</varname>() does the same.
	    The only error condition from
	    <varname>unicode_decompose</varname>() is a non-0 error code
	    from the <varname>reallocate</varname> function. Otherwise:
	    a successful decomposition results in
	    <varname>unicode_decompose</varname>() returning 0 and
	    <function>unicode_decomposition_init</function>()'s
	    <varname>string</varname> pointing to the decomposed string
	    and <varname>string_size</varname> giving the number of
	    characters in the decomposed string.
	  </para>

	  <note>
	    <para>
	      <varname>string_size</varname> does not include the trailing
	      <literal>\0</literal> character.
	      The input string also has its
	      <varname>string_size</varname> specified without counting its
	      <literal>\0</literal> character.
	      The default implementation of <varname>reallocate</varname>
	      allocates an extra <classname>char32_t</classname> ands sets it
	      to a <literal>\0</literal>. Therefore:
	    </para>

	    <itemizedlist>
	      <listitem>
		<para>
		  If the Unicode string before decomposition has a trailing
		  <literal>\0</literal> and no decomposition occurs, and
		  no calls to <varname>reallocate</varname> takes place:
		  the <varname>string</varname> in the
		  <classname>unicode_decomposition_t</classname> is unchanged
		  and it's still
		  <literal>\0</literal>-terminated.
		</para>
	      </listitem>

	      <listitem>
		<para>
		  The default <varname>reallocate</varname> allocates an
		  extra <classname>char32_t</classname> ands sets it
		  to a <literal>\0</literal>; and it takes care of
		  that for the decomposed string.
		</para>
	      </listitem>

	      <listitem>
		<para>
		  An application that provides its own replacement
		  <varname>reallocate</varname> is responsible for doing
		  the same, if it wants the decomposed string to be
		  <literal>\0</literal> terminated.
		</para>
	      </listitem>
	    </itemizedlist>
	  </note>

	  <note>
	    <para>
	      Multiple calls to the <varname>reallocate</varname> callback
	      are possible. Each call to <varname>reallocate</varname>
	      reflect the prior calls' decompositions. Example:
	      the original string has five characters and the first call
	      to <varname>reallocate</varname> had two offsets, at position
	      1 and 3, with a value of 1 for their both
	      <varname>sizes</varname>.
	      This effects transforming an original Unicode string
	      "AAAAA" into
	      "AXAAXAA" (with <quote>A</quote> representing unspecified
	      characters in the original string, and <quote>X</quote> showing
	      the two characters added in the first call to
	      <function>reallocate</function>.
	    </para>

	    <para>
	      A second call to <varname>varname</varname> with am offset
	      at position 4, and a size of 1, results in the updated
	      string of "AXAAYXAA" (with <quote>Y</quote>) marking an
	      unspecified character inserted by the second call.
	    </para>
	  </note>

	  <note>
	    <para>
	      Unicode string decomposition involves replacing a given
	      Unicode character with one or more other characters.
	      The sizes given to <varname>reallocate</varname> reflect the
	      net addition to the Unicode string. For example: decomposing
	      one Unicode character into three decomposed characters results
	      in a call to <varname>reallocate</varname> reporting an
	      insert of two more characters.
	    </para>
	  </note>

	  <note>
	    <para>
	      <varname>offsets</varname> actually report the indices
	      of each Unicode character that's getting decomposed. A 1:1
	      decomposition of a Unicode Character gets reported as an
	      additional <varname>sizes</varname> entry of 0.
	    </para>
	  </note>

	  <para>
	    <function>unicode_decomposition_deinit</function>() releases
	    all resources and destroys the
	    <classname>unicode_decomposition_t</classname>; it is no longer
	    valid.
	  </para>

	  <note>
	    <para>
	      <function>unicode_decomposition_deinit</function>() does not
	      <citerefentry>
		<refentrytitle>free</refentrytitle>
		<manvolnum>3</manvolnum>
	      </citerefentry>
	      the <varname>string</varname>. The original string gets passed
	      in to <function>unicode_decomposition_init</function>() and
	      the decomposed string is left in the <varname>string</varname>.
	    </para>
	  </note>
	  <para>
	      The default implementation of the
	      <varname>reallocate</varname> function assumes the
	      <varname>string</varname> is a
	      <citerefentry>
		<refentrytitle>malloc</refentrytitle>
		<manvolnum>3</manvolnum>
		</citerefentry>-ed string, and
		<function>realloc</function>s it.
	  </para>

	  <note>
	    <para>
	      At this time
	      <function>unicode_decomposition_deinit</function>() does
	      nothing. All code should explicitly call it in order to
	      remain forward-compatible (at the source level).
	    </para>
	  </note>

	  <para>
	    <function>unicode_compose</function>() performs a canonical
	    composition of a decomposed string. Its parameters are:
	  </para>

	  <itemizedlist>
	    <listitem>
	      <para>
		A pointer to the decomposed Unicode string.
	      </para>
	    </listitem>

	    <listitem>
	      <para>
		The number of characters in the Unicode string.
		The Unicode string does not need to be
		<literal>\0</literal>-terminated; if it is this number
		does not include it.
	      </para>
	    </listitem>

	    <listitem>
	      <para>
		A flags bitmask, which can have the following values:
	      </para>

	      <variablelist>
		<varlistentry>
		  <term><literal>UNICODE_COMPOSE_FLAG_REMOVEUNUSED</literal></term>
		  <listitem>
		    <para>
		      Remove all combining marks after doing all canonical
		      compositions. Normally any unused combining marks
		      are left in place, in the combined text. This option
		      removes them.
		    </para>
		  </listitem>
		</varlistentry>
		<varlistentry>
		  <term><literal>UNICODE_COMPOSE_FLAG_ONESHOT</literal></term>
		  <listitem>
		    <para>
		      Perform canonical composition once per character, and
		      do not attempt to combine any resulting combined
		      characters again.
		    </para>
		  </listitem>
		</varlistentry>
	      </variablelist>
	    </listitem>

	    <listitem>
	      <para>
		A non-<literal>NULL</literal> pointer to a
		<classname>size_t</classname>.
	      </para>

	      <para>
		A successful composition sets this <classname>size_t</classname>
		to the number of characters in the combined string, and returns
		0. The combined string gets
		placed back into the <parameter>string</parameter> parameter,
		this string gets combined in place and this gives the
		size of the combined string.
	      </para>

	      <para>
		<function>unicode_compose</function>() returns a non-zero
		value to indicate an error.
	      </para>
	    </listitem>
	  </itemizedlist>

	  <para>
	    <function>unicode_composition_init</function>(),
	    <function>unicode_composition_apply</function>()
	    and <function>unicode_composition_deinit</function>()
	    implement a detailed interface for canonical composition
	    of a decomposed Unicode string:
	  </para>

	  <blockquote>
	    <informalexample>
	      <programlisting><![CDATA[
unicode_compositions_t compositions;

if (unicode_composition_init(str, strsize, flags, &compositions) == 0)
{
    size_t new_size=unicode_composition_apply(str, strsize, &compositions);

    unicode_composition_deinit(&compositions);
}]]></programlisting>
	    </informalexample>
	  </blockquote>

	  <para>
	    The first two parameters to both
	    <function>unicode_composition_init</function>()
	    and
	    <function>unicode_composition_apply</function>()
	    are the same:
	    the Unicode string and the number of characters (not including
	    any trailing <literal>\0</literal> character) in the Unicode string.
	  </para>

	  <para>
	    <function>unicode_composition_init</function>()'s additional
	    parameters are: any optional flags
	    (see <function>unicode_compose()</function> for a list of
	    available flags), and the address of a
	    <classname>unicode_composition_t</classname> object.
	    A non-0 return from
	    <function>unicode_composition_init</function>() indicates an
	    error.
	    <function>unicode_composition_init</function>() indicates success
	    by returning 0 and initializing the
	    <classname>unicode_composition_t</classname>'s object
	    which contains a pointer to an array of pointers to
	    of <structname>unicode_compose_info</structname> objects, and
	    the number of pointers.
	    <function>unicode_composition_init</function>() does not change
	    the string; the only thing it does is initialize the
	    <structname>unicode_composition_t</structname> object.
	  </para>

	  <para>
	    <function>unicode_composition_apply</function>() applies the
	    compositions to the <varname>string</varname>, in place, and
	    returns the new size of the <varname>string</varname>
	    (also not including the <literal>\0</literal> byte, however it
	    does append one if the composed string is smaller, so the
	    composed string is <literal>\0</literal>-terminated if the
	    decomposed string was).
	  </para>

	  <para>
	    It is necessary to call
	    <function>unicode_composition_deinit</function>() to free all
	    memory that was allocated for the
	    <classname>unicode_composition_t</classname> object:
	  </para>

	  <blockquote>




	    <informaltable border='0' colsep='0'>
	      <tgroup cols="3">
		<colspec colname='c1' />
		<colspec colname='c2' />
		<colspec colname='c3' />
		<tbody>
		  <row>
		    <entry namest='c1' nameend='c3'>struct&nbsp;<structname>unicode_compose_info</structname> {</entry>
		  </row>

		  <row>
		    <entry namest='c2'>size_t</entry>
		    <entry><varname>index</varname>;</entry>
		  </row>
		  <row>
		    <entry namest='c2'>size_t</entry>
		    <entry><varname>n_composed</varname>;</entry>
		  </row>
		  <row>
		    <entry namest='c2'>char32_t</entry>
		    <entry>*<varname>composition</varname>;</entry>
		  </row>
		  <row>
		    <entry namest='c2'>size_t</entry>
		    <entry><varname>n_composition</varname>;</entry>
		  </row>
		  <row>
		    <entry namest='c1' nameend='c3'>};</entry>
		  </row>
		  <row>
		    <entry namest='c1' nameend='c3'>&nbsp;</entry>
		  </row>
		  <row>
		    <entry namest='c1' nameend='c3'>typedef&nbsp;struct&nbsp;{</entry>
		  </row>

		  <row>
		    <entry namest='c2'>struct&nbsp;<structname>unicode_compose_info</structname></entry>
		    <entry>**<varname>compositions</varname>;</entry>
		  </row>
		  <row>
		    <entry namest='c2'>size_t</entry>
		    <entry><varname>n_compositions</varname>;</entry>
		  </row>
		  <row>
		    <entry namest='c1' nameend='c3'>} unicode_composition_t;</entry>
		  </row>
		</tbody>
	      </tgroup>
	    </informaltable>
	  </blockquote>

	  <para>
	    <varname>index</varname> gives the character index in the
	    <varname>string</varname> where each composition occurs.
	    <varname>n_composed</varname> gives the number of characters
	    in the original string that get composed.
	    The composed characters are the
	    <varname>composition</varname>;
	    and <varname>n_composition</varname> gives the
	    number of composed characters.
	  </para>

	  <para>
	    Effectively: at the <varname>index</varname> position in the
	    original string, #<varname>n_composed</varname> characters get
	    removed and there are #<varname>n_composition</varname>
	    characters that replace them (always <varname>n_composed</varname>
	    or less).
	  </para>

	  <note>
	    <para>
	      The <literal>UNICODE_COMPOSE_FLAG_REMOVEUNUSED</literal> flag
	      has the effect of including
	      the combining marks that did not get combined
	      in the <varname>n_composed</varname> count. It's possible that,
	      in this case, <varname>n_composition</varname> is 0.
	      This indicates complete removal of the combining marks, without
	      anything getting combined in their place.
	    </para>
	  </note>

	  <para>
	    <function>unicode_composition_init</function>()
	    sets <classname>unicode_composition_t</classname>'s
	    <varname>compositions</varname> pointer to an array of
	    pointers to <structname>unicode_compose_info</structname>s
	    that are sorted according to their <varname>index</varname>.
	    <varname>n_compositions</varname> gives the number of pointers
	    in the array, and is 0 if there are no compositions, the
	    array is empty.
	    The empty array gets interpreted accordingly
	    when it gets passed to
	    <function>unicode_composition_apply</function>() and
	    <function>unicode_composition_deinit</function>(): nothing
	    happens. <function>unicode_composition_apply</function>()
	    simply returns the size of the unchanged <varname>string</varname>,
	    and <function>unicode_composition_deinit</function>() does a
	    pro-forma cleanup.
	  </para>
	</refsect1>
	<refsect1 id="unicode_canonical_seealso">
	  <title>SEE ALSO</title>
	  <para>
	    <ulink url="https://www.unicode.org/reports/tr15/tr15-&tr15ver;.html">TR-15</ulink>,
	    <link linkend="courier-unicode">
	      <citerefentry>
		<refentrytitle>courier-unicode</refentrytitle>
		<manvolnum>7</manvolnum></citerefentry></link>,
		<link linkend="unicode__canonical">
		  <citerefentry>
		  <refentrytitle>unicode::canonical</refentrytitle>
		  <manvolnum>3</manvolnum></citerefentry></link>.
	  </para>
	</refsect1>
      </refentry>

      <refentry id="unicode_category_lookup">
	<refentryinfo><author><firstname>Sam</firstname><surname>Varshavchik</surname><contrib>Author</contrib></author><productname>Courier Unicode Library</productname></refentryinfo>

	<refmeta>
	  <refentrytitle>unicode_category_lookup</refentrytitle>
	  <manvolnum>3</manvolnum>
	</refmeta>

	<refnamediv>
	  <refname>unicode_category_lookup</refname>
	  <refname>unicode_isalnum</refname>
	  <refname>unicode_isalpha</refname>
	  <refname>unicode_isblank</refname>
	  <refname>unicode_isdigit</refname>
	  <refname>unicode_isgraph</refname>
	  <refname>unicode_islower</refname>
	  <refname>unicode_ispunct</refname>
	  <refname>unicode_isspace</refname>
	  <refname>unicode_isupper</refname>

	  <refpurpose>unicode character categorization</refpurpose>
	</refnamediv>

	<refsynopsisdiv>
	  <funcsynopsis>
	    <funcsynopsisinfo>#include &lt;courier-unicode.h&gt;</funcsynopsisinfo>
	    <funcprototype>
	      <funcdef>uint32_t <function>unicode_category_lookup</function></funcdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode_isalnum</function></funcdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode_isalpha</function></funcdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode_isblank</function></funcdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode_isdigit</function></funcdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode_isgraph</function></funcdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode_islower</function></funcdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode_ispunct</function></funcdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode_isspace</function></funcdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode_isupper</function></funcdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>
	  </funcsynopsis>
	</refsynopsisdiv>
	<refsect1 id="unicode_category_descr">
	  <title>DESCRIPTION</title>

	  <para>
	    <function>unicode_category_lookup</function>() looks up the
	    <ulink url="https://unicode.org/notes/tn36/">unicode character's
	    categorization</ulink>.
	    <function>unicode_category_lookup</function>() returns a 32 bit
	    value.
	    The value's
	    <symbol>UNICODE_CATEGORY_1</symbol> bits specify the first level
	    of the unicode character's category, with
	    <symbol>UNICODE_CATEGORY_2</symbol>,
	    <symbol>UNICODE_CATEGORY_3</symbol>, and
	    <symbol>UNICODE_CATEGORY_4</symbol> bits specifying the 2nd,
	    3rd, and 4th level, if given. A value of 0 for each corresponding
	    bit set indicates that no category is specified for this level,
	    for this character; otherwise the possible values are defined
	    in <filename>&lt;courier-unicode.h&gt;</filename>.
	  </para>

	  <para>
	    The remaining functions implement comparable equivalents of
	    their non-unicode versions in the standard C library, as follows:
	  </para>

	  <variablelist>
	    <varlistentry>
              <term><function>unicode_isalnum</function>()</term>
	      <listitem>
		<para>
		  Returns non-0 for all
		  <function>unicode_isalpha</function>() or
		  <function>unicode_isdigit</function>().
		</para>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
              <term><function>unicode_isalpha</function>()</term>
	      <listitem>
		<para>
		  Returns non-0 for all
		  <symbol>UNICODE_CATEGORY_1_LETTER</symbol>.
		</para>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
              <term><function>unicode_isblank</function>()</term>
	      <listitem>
		<para>
		  Return non-0 for
		  <symbol>TAB</symbol>, and all
		  <symbol>UNICODE_CATEGORY_2_SPACE</symbol>.
		</para>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
              <term><function>unicode_isdigit</function>()</term>
	      <listitem>
		<para>
		  Returns non-0 for all
		  <symbol>UNICODE_CATEGORY_1_NUMBER</symbol>
		  | <symbol>UNICODE_CATEGORY_2_DIGIT</symbol>,
		  only (no third categories).
		</para>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
              <term><function>unicode_isgraph</function>()</term>
	      <listitem>
		<para>
		  Returns non-0 for all codepoints above
		  <symbol>SPACE</symbol> which are not
		  <function>unicode_isspace</function>().
		</para>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
              <term><function>unicode_islower</function>()</term>
	      <listitem>
		<para>
		  Returns non-0 for all
		  <function>unicode_isalpha</function>() for which the
		  character is
		  equal to
		  <link linkend="unicode_uc">
		    <citerefentry><refentrytitle>unicode_lc</refentrytitle>
		  <manvolnum>3</manvolnum></citerefentry></link>
		  of itself.
		</para>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
              <term><function>unicode_ispunct</function>()</term>
	      <listitem>
		<para>
		  Returns non-0 for all
		  <symbol>UNICODE_CATEGORY_1_PUNCTUATION</symbol>.
		</para>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
              <term><function>unicode_isspace</function>()</term>
	      <listitem>
		<para>
		  Returns non-0 for unicode_isblank() or
		  for unicode characters
		  with linebreaking properties of
		  <symbol>BK</symbol>,
		  <symbol>CR</symbol>,
		  <symbol>LF</symbol>,
		  <symbol>NL</symbol>,
		  and
		  <symbol>SP</symbol>.
		</para>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
              <term><function>unicode_isupper</function>()</term>
	      <listitem>
		<para>
		  Returns non-0 for all
		  <function>unicode_isalpha</function>() for which the
		  character is
		  equal to
		  <link linkend="unicode_uc">
		    <citerefentry><refentrytitle>unicode_uc</refentrytitle>
		  <manvolnum>3</manvolnum></citerefentry></link>
		  of itself.
		</para>
	      </listitem>
	    </varlistentry>
	  </variablelist>
	</refsect1>
	<refsect1 id="unicode_category_seealso">
	  <title>SEE ALSO</title>
	  <para>
	    <link linkend="courier-unicode">
	      <citerefentry>
		<refentrytitle>courier-unicode</refentrytitle>
		<manvolnum>7</manvolnum></citerefentry></link>,
	    <link linkend="unicode_uc">
	      <citerefentry><refentrytitle>unicode_convert_tocase</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>.
	  </para>
	</refsect1>
      </refentry>

      <refentry id="unicode_convert">
	<refentryinfo><author><firstname>Sam</firstname><surname>Varshavchik</surname><contrib>Author</contrib></author><productname>Courier Unicode Library</productname></refentryinfo>

	<refmeta>
	  <refentrytitle>unicode_convert</refentrytitle>
	  <manvolnum>3</manvolnum>
	</refmeta>

	<refnamediv>
	  <refname>unicode_u_ucs4_native</refname>
	  <refname>unicode_u_ucs2_native</refname>
	  <refname>unicode_convert_init</refname>
	  <refname>unicode_convert</refname>
	  <refname>unicode_convert_deinit</refname>

          <refname>unicode_convert_tocbuf_init</refname>
	  <refname>unicode_convert_tou_init</refname>
	  <refname>unicode_convert_fromu_init</refname>
	  <refname>unicode_convert_uc</refname>

	  <refname>unicode_convert_tocbuf_toutf8_init</refname>
	  <refname>unicode_convert_tocbuf_fromutf8_init</refname>

	  <refname>unicode_convert_toutf8</refname>
	  <refname>unicode_convert_fromutf8</refname>
	  <refname>unicode_convert_tobuf</refname>
	  <refname>unicode_convert_tou_tobuf</refname>
	  <refname>unicode_convert_fromu_tobuf</refname>

	  <refpurpose>unicode character set conversion</refpurpose>
	</refnamediv>

	<refsynopsisdiv>
	  <funcsynopsis>
	    <funcsynopsisinfo>#include &lt;courier-unicode.h&gt;

	    extern const char unicode_u_ucs4_native[];

	    extern const char unicode_u_ucs2_native[];</funcsynopsisinfo>
	    <funcprototype>
              <funcdef>unicode_convert_handle_t <function>unicode_convert_init</function></funcdef>
              <paramdef>const char *<parameter>src_chset</parameter></paramdef>
              <paramdef>const char *<parameter>dst_chset</parameter></paramdef>
              <paramdef>void *<parameter>cb_arg</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode_convert</function></funcdef>
              <paramdef>unicode_convert_handle_t <parameter>handle</parameter></paramdef>
              <paramdef>const char *<parameter>text</parameter></paramdef>
              <paramdef>size_t <parameter>cnt</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode_convert_deinit</function></funcdef>
              <paramdef>unicode_convert_handle_t <parameter>handle</parameter></paramdef>
              <paramdef>int *<parameter>errptr</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>unicode_convert_handle_t <function>unicode_convert_tocbuf_init</function></funcdef>
              <paramdef>const char *<parameter>src_chset</parameter></paramdef>
              <paramdef>const char *<parameter>dst_chset</parameter></paramdef>
	      <paramdef>char **<parameter>cbufptr_ret</parameter></paramdef>
	      <paramdef>size_t *<parameter>cbufsize_ret</parameter></paramdef>
              <paramdef>int <parameter>nullterminate</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>unicode_convert_handle_t <function>unicode_convert_tocbuf_toutf8_init</function></funcdef>
              <paramdef>const char *<parameter>src_chset</parameter></paramdef>
	      <paramdef>char **<parameter>cbufptr_ret</parameter></paramdef>
	      <paramdef>size_t *<parameter>cbufsize_ret</parameter></paramdef>
              <paramdef>int <parameter>nullterminate</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>unicode_convert_handle_t <function>unicode_convert_tocbuf_fromutf8_init</function></funcdef>
              <paramdef>const char *<parameter>dst_chset</parameter></paramdef>
	      <paramdef>char **<parameter>cbufptr_ret</parameter></paramdef>
	      <paramdef>size_t *<parameter>cbufsize_ret</parameter></paramdef>
              <paramdef>int <parameter>nullterminate</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>unicode_convert_handle_t <function>unicode_convert_tou_init</function></funcdef>
              <paramdef>const char *<parameter>src_chset</parameter></paramdef>
	      <paramdef>char32_t **<parameter>ucptr_ret</parameter></paramdef>
	      <paramdef>size_t *<parameter>ucsize_ret</parameter></paramdef>
              <paramdef>int <parameter>nullterminate</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>unicode_convert_handle_t <function>unicode_convert_fromu_init</function></funcdef>
              <paramdef>const char *<parameter>dst_chset</parameter></paramdef>
	      <paramdef>char **<parameter>cbufptr_ret</parameter></paramdef>
	      <paramdef>size_t *<parameter>cbufsize_ret</parameter></paramdef>
              <paramdef>int <parameter>nullterminate</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode_convert_uc</function></funcdef>
              <paramdef>unicode_convert_handle_t <parameter>handle</parameter></paramdef>
              <paramdef>const char32_t *<parameter>text</parameter></paramdef>
	      <paramdef>size_t <parameter>cnt</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>char *<function>unicode_convert_toutf8</function></funcdef>
              <paramdef>const char *<parameter>text</parameter></paramdef>
              <paramdef>const char *<parameter>charset</parameter></paramdef>
	      <paramdef>int *<parameter>error</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>char *<function>unicode_convert_fromutf8</function></funcdef>
              <paramdef>const char *<parameter>text</parameter></paramdef>
              <paramdef>const char *<parameter>charset</parameter></paramdef>
	      <paramdef>int *<parameter>error</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>char *<function>unicode_convert_tobuf</function></funcdef>
              <paramdef>const char *<parameter>text</parameter></paramdef>
              <paramdef>const char *<parameter>charset</parameter></paramdef>
              <paramdef>const char *<parameter>dstcharset</parameter></paramdef>
	      <paramdef>int *<parameter>error</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode_convert_toubuf</function></funcdef>
              <paramdef>const char *<parameter>text</parameter></paramdef>
	      <paramdef>size_t <parameter>text_l</parameter></paramdef>
              <paramdef>const char *<parameter>charset</parameter></paramdef>
              <paramdef>char32_t **<parameter>uc</parameter></paramdef>
	      <paramdef>size_t *<parameter>ucsize</parameter></paramdef>
	      <paramdef>int *<parameter>error</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode_convert_fromu_tobuf</function></funcdef>
              <paramdef>const char32_t *<parameter>utext</parameter></paramdef>
	      <paramdef>size_t <parameter>utext_l</parameter></paramdef>
              <paramdef>const char *<parameter>charset</parameter></paramdef>
              <paramdef>char **<parameter>c</parameter></paramdef>
	      <paramdef>size_t *<parameter>csize</parameter></paramdef>
	      <paramdef>int *<parameter>error</parameter></paramdef>
	    </funcprototype>

	  </funcsynopsis>

	</refsynopsisdiv>

	<refsect1 id="unicode_convert_descr">
	  <title>DESCRIPTION</title>

	  <para>
	    <varname>unicode_u_ucs4_native</varname>[] contains the
	    string <quote>UCS-4BE</quote> or <quote>UCS-4LE</quote>,
	    matching the native <classname>char32_t</classname> endianness.
	  </para>

	  <para>
	    <varname>unicode_u_ucs2_native</varname>[] contains the
	    string <quote>UCS-2BE</quote> or <quote>UCS-2LE</quote>,
	    matching the native <classname>char32_t</classname> endianness.
	  </para>

	  <para>
	    <function>unicode_convert_init</function>(),
	    <function>unicode_convert</function>(), and
	    <function>unicode_convert_deinit</function>() are an adaption of th
	    <ulink url="https://manpages.courier-mta.org/htmlman3/iconv.3.html">
	      <citerefentry><refentrytitle>iconv</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></ulink> API that uses the same
	      calling convention as the other algorithms in this unicode library,
	      with some value-added features.
	      These functions use
	      <citerefentry><refentrytitle>iconv</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry> to effect the actual
	      character set conversion.
	  </para>

	  <para>
	    <function>unicode_convert_init</function>() returns a non-NULL handle
	    for the requested conversion, or NULL if the requested conversion is
	    not available.

	    <function>unicode_convert_init</function>() takes a pointer to
	    the output function that receives receives converted character text.
	    The output function receives a pointer to the converted character
	    text, and the number of characters in the converted text.
	    The output function gets repeatedly called, until it receives
	    the entire converted text.
	  </para>

	  <para>
	    The character text to convert gets passed, repeatedly, to
	    <function>unicode_convert</function>().
	    Each call to <function>unicode_convert</function>() results in
	    the output function getting invoked, zero or more times, with each
	    successive part of the
	    converted text. Finally,
	    <function>unicode_convert_deinit</function>() stops the conversion
	    and deallocates the conversion handle.
	  </para>

	  <para>
	    It's possible that a call to
	    <function>unicode_convert_deinit</function>() results in some
	    additional calls to the output function, passing the remaining,
	    final parts, of the converted text, before
	    <function>unicode_convert_deinit</function>() deallocates the
	    handle, and returns.
	  </para>

	  <para>
	    The output function should return 0 normally. A non-0 return
	    indicates n error condition.
	    <function>unicode_convert_deinit</function>() returns
	    non-zero if any previous invocation of the output function returned
	    non-zero (this includes any invocations of the output function
	    resulting from this call, or prior
	    <function>unicode_convert</function>() calls), or 0 if all
	    invocations of the output function returned 0.
	  </para>

	  <para>
	    If the <parameter>errptr</parameter> is not <literal>NULL</literal>,
	    *<parameter>errptr</parameter> gets set to non-zero if there were
	    any conversion errors -- if there was any text that could not be
	    converted to the destination character text.
	  </para>

	  <para>
	    <function>unicode_convert</function>() also returns non-zero if
	    it calls the output function and it returns non-zero, however
	    the conversion handle remains allocated, so
	    <function>unicode_convert_deinit</function>() must still be called,
	    to clean that up.
	  </para>


	  <refsect2 id="unicode_convert_collect">
	    <title>Collecting converted text into a buffer</title>

	    <para>
	      Call
	      <function>unicode_convert_tocbuf_init</function>()
	      instead of
	      <function>unicode_convert_init</function>(), then call
	      <function>unicode_convert</function>()
	      and
	      <function>unicode_convert_deinit</function>() normally.

	      The parameters to
	      <function>unicode_convert_init</function>() specify the source
	      and the destination character sets.

	      <function>unicode_convert_tocbuf_toutf8_init</function>() is
	      just an alias that specifies <literal>UTF-8</literal> as the
	      destination character set.

	      <function>unicode_convert_tocbuf_fromutf8_init</function>() is
	      just an alias that specifies <literal>UTF-8</literal> as the
	      source character st.

	    </para>

	    <para>
	      These functions
	      supply an output function that collects the converted text into
	      a malloc()ed buffer.

	      If <function>unicode_convert_deinit</function>() returns 0,
	      *<parameter>cbufptr_ret</parameter> gets initialized to a
	      malloc()ed buffer, and the number of converted characters,
	      the size of the
	      malloc()ed buffer, get placed into
	      *<parameter>cbufsize_ret</parameter>.
	    </para>

	    <note>
	      <para>
		If the converted string is an empty string,
		*<parameter>cbufsize_ret</parameter>
		gets set to 0,
		but
		*<parameter>cbufptr_ret</parameter>
		still gets initialized (to a dummy malloced buffer).
	      </para>
	    </note>

	    <para>
	      A non-zero <parameter>nullterminate</parameter> places a trailing \0
	      character after the converted string (this is included in
	      *<parameter>cbufsize_ret</parameter>).
	    </para>
	  </refsect2>

	  <refsect2 id="unicode_convert_chset_unicode">
	    <title>Converting between character sets and unicode</title>

	    <para>
	      <function>unicode_convert_tou_init</function>()
	      converts character text into a <classname>char32_t</classname>
	      buffer.
	      It works just like
	      <function>unicode_convert_tocbuf_init</function>(), except
	      that only the source character set gets specified and the output
	      buffer is a <classname>char32_t</classname> buffer.
	      <parameter>nullterminate</parameter> terminates the converted
	      unicode characters with a <literal>U+0000</literal>.
	    </para>

	    <para>
	      <function>unicode_convert_fromu_init</function>()
	      converts <classname>char32_t</classname>s to the output
	      character set, and also works like
	      <function>unicode_convert_tocbuf_init</function>().
	      Additionally, in this case,
	      <function>unicode_convert_uc</function>() works just like
	      <function>unicode_convert</function>() except that the
	      input sequence is a
	      <classname>char32_t</classname> sequence, and the
	      count parameter is th enumber of unicode characters.
	    </para>
	  </refsect2>

	  <refsect2 id="unicode_convert_oneshot">
	    <title>One-shot conversions</title>

	    <para>
	      <function>unicode_convert_toutf8</function>()
	      converts the specified text in the specified text into a UTF-8
	      string, returning a malloced buffer.
	      If <parameter>error</parameter> is
	      not <literal>NULL</literal>, even if
	      <function>unicode_convert_toutf8</function>()
	      returns a non <literal>NULL</literal> value
	      *<parameter>error</parameter> gets set to a non-zero value if
	      a character conversion error has occured, and some characters
	      could not be converted.
	    </para>

	    <para>
	      <function>unicode_convert_fromutf8</function>() does a similar
	      conversion from UTF-8 <parameter>text</parameter> to the specified
	      character set.
	    </para>

	    <para>
	      <function>unicode_convert_tobuf</function>() does a similar
	      conversion between two different character sets.
	    </para>

	    <para>
	      <function>unicode_convert_tou_tobuf</function>() calls
	      <function>unicode_convert_tou_init</function>(), feeds the
	      character string through <function>unicode_convert</function>(),
	      then calls <function>unicode_convert_deinit</function>().
	      If this function returns 0,
	      *<parameter>uc</parameter> and *<parameter>ucsize</parameter>
	      are set to a malloced buffer+size holding the unicode char array.
	    </para>

	    <para>
	      <function>unicode_convert_fromu_tobuf</function>() calls
	      <function>unicode_convert_fromu_init</function>(), feeds the
	      unicode array through <function>unicode_convert_uc</function>(),
	      then calls unicode_convert_deinit().

	      If this function returns 0,
	      *<parameter>c</parameter> and *<parameter>csize</parameter>
	      are set to a malloced buffer+size holding the char array.
	    </para>
	  </refsect2>
	</refsect1>
	<refsect1 id="unicode_convert_seealso">
	  <title>SEE ALSO</title>
	  <para>
	    <link linkend="courier-unicode">
	      <citerefentry>
		<refentrytitle>courier-unicode</refentrytitle>
		<manvolnum>7</manvolnum></citerefentry></link>,
	    <link linkend="unicode_uc">
	      <citerefentry><refentrytitle>unicode_convert_tocase</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	      <link linkend="unicode_default_chset">
		<citerefentry><refentrytitle>unicode_default_chset</refentrytitle>
		<manvolnum>3</manvolnum></citerefentry></link>.
	  </para>
	</refsect1>
      </refentry>

      <refentry id="unicode_default_chset">
	<refentryinfo><author><firstname>Sam</firstname><surname>Varshavchik</surname><contrib>Author</contrib></author><productname>Courier Unicode Library</productname></refentryinfo>

	<refmeta>
	  <refentrytitle>unicode_default_chset</refentrytitle>
	  <manvolnum>3</manvolnum>
	</refmeta>

	<refnamediv>
	  <refname>unicode_default_chset</refname>
	  <refname>unicode_locale_chset</refname>
	  <refpurpose>return the system character set name</refpurpose>
	</refnamediv>

	<refsynopsisdiv>
	  <funcsynopsis>
	    <funcsynopsisinfo>#include &lt;courier-unicode.h&gt;</funcsynopsisinfo>
	    <funcprototype>
              <funcdef>const char *<function>unicode_default_chset</function></funcdef>
	      <void />
	    </funcprototype>

	    <funcprototype>
              <funcdef>const char *<function>unicode_locale_chset</function></funcdef>
	      <void />
	    </funcprototype>
	  </funcsynopsis>
	</refsynopsisdiv>
	<refsect1 id="unicode_default_chset_descr">
	  <title>DESCRIPTION</title>
	  <para>
	    <function>unicode_default_chset</function>() returns the name of the
	    system environment character set (usually
	    <quote>nl_langinfo(CODESET)</quote>, or from some suitable environment
	    variable).
	    <function>unicode_locale_chset</function>() returns the name of the
	    current application locale's character set.
	  </para>
	</refsect1>
	<refsect1 id="unicode_default_chset_seealso">
	  <title>SEE ALSO</title>
	  <para>
	    <link linkend="courier-unicode">
	      <citerefentry>
		<refentrytitle>courier-unicode</refentrytitle>
		<manvolnum>7</manvolnum></citerefentry></link>,
	    <link linkend="unicode_uc">
	      <citerefentry><refentrytitle>unicode_convert_tocase</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>.
	  </para>
	</refsect1>
      </refentry>

      <refentry id="unicode_emoji_lookup">
	<refentryinfo><author><firstname>Sam</firstname><surname>Varshavchik</surname><contrib>Author</contrib></author><productname>Courier Unicode Library</productname></refentryinfo>

	<refmeta>
	  <refentrytitle>unicode_emoji_lookup</refentrytitle>
	  <manvolnum>3</manvolnum>
	</refmeta>

	<refnamediv>
	  <refname>unicode_emoji_lookup</refname>
          <refname>unicode_emoji</refname>
          <refname>unicode_emoji_presentation</refname>
	  <refname>unicode_emoji_modifier</refname>
	  <refname>unicode_emoji_modifier_base</refname>
	  <refname>unicode_emoji_component</refname>
	  <refname>unicode_emoji_extended_pictographic</refname>

	  <refpurpose>look up unicode character's Unicode Emoji Classification</refpurpose>
	</refnamediv>

	<refsynopsisdiv>
	  <funcsynopsis>
	    <funcsynopsisinfo>#include &lt;courier-unicode.h&gt;</funcsynopsisinfo>
	    <funcprototype>
              <funcdef>unicode_emoji_t <function>unicode_emoji_lookup</function></funcdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>
	  </funcsynopsis>

	  <funcsynopsis>
	    <funcprototype>
              <funcdef>int <function>unicode_emoji</function></funcdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>
	  </funcsynopsis>

	  <funcsynopsis>
	    <funcprototype>
              <funcdef>int <function>unicode_emoji_presentation</function></funcdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>
	  </funcsynopsis>

	  <funcsynopsis>
	    <funcprototype>
              <funcdef>int <function>unicode_emoji_modifier</function></funcdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>
	  </funcsynopsis>

	  <funcsynopsis>
	    <funcprototype>
              <funcdef>int <function>unicode_emoji_modifier_base</function></funcdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>
	  </funcsynopsis>

	  <funcsynopsis>
	    <funcprototype>
              <funcdef>int <function>unicode_emoji_component</function></funcdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>
	  </funcsynopsis>

	  <funcsynopsis>
	    <funcprototype>
              <funcdef>int <function>unicode_emoji_extended_pictographic</function></funcdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>
	  </funcsynopsis>
	</refsynopsisdiv>
	<refsect1 id="unicode_emoji_descr">
	  <title>DESCRIPTION</title>
	  <para>
	    <function>unicode_emoji_lookup</function>() returns the
	    unicode emoji properties of the specified character, as a bitmask
	    of <literal>UNICODE_EMOJI</literal> flags, as defined in the
	    header file.
	    <function>unicode_emoji</function>(),
	    <function>unicode_emoji_presentation</function>(),
	    <function>unicode_emoji_modifier</function>(),
	    <function>unicode_emoji_modifier_base</function>(),
	    <function>unicode_emoji_component</function>(), and
	    <function>unicode_emoji_extended_pictographic</function>()
	    check whether the given character carries a specific emoji
	    property. They return 0 if not, and non-0 if the specified
	    character has the corresponding property.
	  </para>
        </refsect1>
	<refsect1 id="unicode_emoji_seealso">
	  <title>SEE ALSO</title>
	  <para>
	    <ulink url="https://www.unicode.org/reports/tr51/tr51-&tr51ver;.html">TR-51</ulink>,
	    <link linkend="courier-unicode">
	      <citerefentry>
		<refentrytitle>courier-unicode</refentrytitle>
		<manvolnum>7</manvolnum></citerefentry></link>.
	  </para>
	</refsect1>
      </refentry>

      <refentry id="unicode_html40ent_lookup">
	<refentryinfo><author><firstname>Sam</firstname><surname>Varshavchik</surname><contrib>Author</contrib></author><productname>Courier Unicode Library</productname></refentryinfo>

	<refmeta>
	  <refentrytitle>unicode_html40ent_lookup</refentrytitle>
	  <manvolnum>3</manvolnum>
	</refmeta>

	<refnamediv>
	  <refname>unicode_html40ent_lookup</refname>
	  <refpurpose>look up unicode character for an HTML 4.0 entity</refpurpose>
	</refnamediv>

	<refsynopsisdiv>
	  <funcsynopsis>
	    <funcsynopsisinfo>#include &lt;courier-unicode.h&gt;</funcsynopsisinfo>
	    <funcprototype>
              <funcdef>char32_t <function>unicode_html40ent_lookup</function></funcdef>
              <paramdef>const char *<parameter>entity</parameter></paramdef>
	    </funcprototype>
	  </funcsynopsis>
	</refsynopsisdiv>
	<refsect1 id="unicode_html40_descr">
	  <title>DESCRIPTION</title>
	  <para>
	    <function>unicode_html40ent_lookup</function>() returns the
	    unicode character represented by an HTML 4.0 entity. The
	    <parameter>entity</parameter> is a string, such as
	    <quote>quot</quote>, in which case
	    <function>unicode_html40ent_lookup</function>() returns 34.
	  </para>

	  <para>
	    Additionally,
	    <function>unicode_html40ent_lookup</function>() parses
	    a numerical entity given as
	    <quote>#<replaceable>decimal</replaceable></quote> or
	    <quote>#x<replaceable>hex</replaceable></quote>.
	  </para>

	  <para>
	    <function>unicode_html40ent_lookup</function>() returns 0 if the
	    <parameter>entity</parameter> is not a known entity that represents
	    a single unicode character.
	  </para>
	</refsect1>
	<refsect1 id="unicode_html40_seealso">
	  <title>SEE ALSO</title>
	  <para>
	    <link linkend="courier-unicode">
	      <citerefentry>
		<refentrytitle>courier-unicode</refentrytitle>
		<manvolnum>7</manvolnum></citerefentry></link>,
	    <link linkend="unicode_uc">
	      <citerefentry><refentrytitle>unicode_convert_tocase</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>.
	  </para>
	</refsect1>
      </refentry>

      <refentry id="unicode_grapheme_break">
	<refentryinfo><author><firstname>Sam</firstname><surname>Varshavchik</surname><contrib>Author</contrib></author><productname>Courier Unicode Library</productname></refentryinfo>
	<refmeta>
	  <refentrytitle>unicode_grapheme_break</refentrytitle>
	  <manvolnum>3</manvolnum>
	</refmeta>

	<refnamediv>
	  <refname>unicode_grapheme_break</refname>
	  <refname>unicode_grapheme_break_init</refname>
	  <refname>unicode_grapheme_break_next</refname>
	  <refname>unicode_grapheme_break_deinit</refname>
	  <refpurpose>unicode grapheme cluster boundary rules</refpurpose>
	</refnamediv>

	<refsynopsisdiv>
	  <funcsynopsis>
	    <funcsynopsisinfo>#include &lt;courier-unicode.h&gt;</funcsynopsisinfo>

	    <funcprototype>
              <funcdef>unicode_grapheme_break_info_t <function>unicode_grapheme_break_init</function></funcdef>
	      <void />
	    </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode_grapheme_next</function></funcdef>
              <paramdef>unicode_grapheme_break_info_t <parameter>handle</parameter></paramdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>void <function>unicode_grapheme_deinit</function></funcdef>
              <paramdef>unicode_grapheme_break_info_t <parameter>handle</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode_grapheme_break</function></funcdef>
              <paramdef>char32_t <parameter>a</parameter></paramdef>
              <paramdef>char32_t <parameter>b</parameter></paramdef>
	    </funcprototype>
	  </funcsynopsis>
	</refsynopsisdiv>
	<refsect1 id="unicode_grapheme_descr">
	  <title>DESCRIPTION</title>

	  <para>
	    These functions implement the unicode grapheme cluster breaking
	    algorithm. Invoke
	    <function>unicode_grapheme_break_init</function>() to initialize
	    the grapheme cluster breaking algorithm.
	    <function>unicode_grapheme_break_init</function>() returns an
	    opaque handle. Each subsequent call to
	    <function>unicode_grapheme_break_next</function>() passes this
	    handle, and the next character.
	    <function>unicode_grapheme_break_next</function>() returns a non-0
	    value if there's a grapheme break before the character, in a
	    sequence of Unicode characters.
	    <function>unicode_grapheme_break_deinit</function>() releases
	    all reosurces used by the grapheme breaking handle, and the
	    <classname>unicode_grapheme_break_info_t</classname> handle
	    is no longer valid after this call.
	  </para>
	  <para>
	    The first call to <function>unicode_grapheme_break_next</function>()
	    always returns non-0, as per the GB1 rule.
	  </para>
	  <para>
	    <function>unicode_grapheme_break</function>() is a simplified
	    interface that returns non-zero
	    if there is a grapheme break between two unicode characters
	    <parameter>a</parameter> and
	    <parameter>b</parameter>.
	    This is is equivalent to calling
	    <function>unicode_grapheme_break_init</function>(),
	    followed by two calls to
	    <function> unicode_grapheme_break_next</function>(), and finally
	    <function>unicode_grapheme_break_deinit</function>(), then
	    returning
	    the result of the second
	    call to <function>unicode_grapheme_break_next</function>().
	  </para>
	</refsect1>

	<refsect1 id="unicode_grapheme_seealso">
	  <title>SEE ALSO</title>

	  <para>
	    <ulink url="https://www.unicode.org/reports/tr29/tr29-&tr29ver;.html">TR-29</ulink>,
	    <link linkend="courier-unicode">
	      <citerefentry>
		<refentrytitle>courier-unicode</refentrytitle>
		<manvolnum>7</manvolnum></citerefentry></link>,
	    <link linkend="unicode_uc">
	      <citerefentry><refentrytitle>unicode_convert_tocase</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	      <link linkend="unicode_line_break">
		<citerefentry><refentrytitle>unicode_line_break</refentrytitle>
		<manvolnum>3</manvolnum></citerefentry></link>,
		<link linkend="unicode_word_break">
		  <citerefentry><refentrytitle>unicode_word_break</refentrytitle>
		  <manvolnum>3</manvolnum></citerefentry></link>.
	  </para>
	</refsect1>
      </refentry>

      <refentry id="unicode_line_break">
	<refentryinfo><author><firstname>Sam</firstname><surname>Varshavchik</surname><contrib>Author</contrib></author><productname>Courier Unicode Library</productname></refentryinfo>
	<refmeta>
	  <refentrytitle>unicode_line_break</refentrytitle>
	  <manvolnum>3</manvolnum>
	</refmeta>

	<refnamediv>
	  <refname>unicode_line_break</refname>
	  <refname>unicode_lb_init</refname>
	  <refname>unicode_lb_set_opts</refname>
	  <refname>unicode_lb_next</refname>
	  <refname>unicode_lb_next_cnt</refname>
	  <refname>unicode_lb_end</refname>

	  <refname>unicode_lbc_init</refname>
	  <refname>unicode_lbc_set_opts</refname>
	  <refname>unicode_lbc_next</refname>
	  <refname>unicode_lbc_next_cnt</refname>
	  <refname>unicode_lbc_end</refname>
	  <refpurpose>calculate mandatory or allowed line breaks</refpurpose>
	</refnamediv>

	<refsynopsisdiv>
	  <funcsynopsis>
	    <funcsynopsisinfo>#include &lt;courier-unicode.h&gt;</funcsynopsisinfo>
	    <funcprototype>
              <funcdef>unicode_lb_info_t <function>unicode_lb_init</function></funcdef>
              <paramdef>int (*<parameter>cb_func</parameter>)(int, void *)</paramdef>
              <paramdef>void *<parameter>cb_arg</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>void <function>unicode_lb_set_opts</function></funcdef>
              <paramdef>unicode_lb_info_t <parameter>lb</parameter></paramdef>
              <paramdef>int <parameter>opts</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode_lb_next</function></funcdef>
              <paramdef>unicode_lb_info_t <parameter>lb</parameter></paramdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode_lb_next_cnt</function></funcdef>
              <paramdef>unicode_lb_info_t <parameter>lb</parameter></paramdef>
              <paramdef>const char32_t *<parameter>cptr</parameter></paramdef>
              <paramdef>size_t <parameter>cnt</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode_lb_end</function></funcdef>
              <paramdef>unicode_lb_info_t <parameter>lb</parameter></paramdef>
	    </funcprototype>
	  </funcsynopsis>

	  <funcsynopsis>
	    <funcprototype>
              <funcdef>unicode_lbc_info_t <function>unicode_lbc_init</function></funcdef>
              <paramdef>int (*<parameter>cb_func</parameter>)(int, char32_t, void *)</paramdef>
              <paramdef>void *<parameter>cb_arg</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>void <function>unicode_lbc_set_opts</function></funcdef>
              <paramdef>unicode_lbc_info_t <parameter>lb</parameter></paramdef>
              <paramdef>int <parameter>opts</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode_lbc_next</function></funcdef>
              <paramdef>unicode_lb_info_t <parameter>lb</parameter></paramdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode_lbc_next_cnt</function></funcdef>
              <paramdef>unicode_lb_info_t <parameter>lb</parameter></paramdef>
              <paramdef>const char32_t *<parameter>cptr</parameter></paramdef>
              <paramdef>size_t <parameter>cnt</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode_lbc_end</function></funcdef>
              <paramdef>unicode_lb_info_t <parameter>lb</parameter></paramdef>
	    </funcprototype>
	  </funcsynopsis>
	</refsynopsisdiv>
	<refsect1 id="unicode_lb_descr">
	  <title>DESCRIPTION</title>
	  <para>
	    These functions implement the unicode line breaking algorithm.
	    Invoke <function>unicode_lb_init</function>() to initialize the
	    line breaking algorithm. The
	    first parameter is a callback function.
	    The second parameter is an opaque pointer.
	    The callback function gets invoked with two parameters. The first
	    parameter is one of three values:
	    <literal>UNICODE_LB_MANDATORY</literal>,
	    <literal>UNICODE_LB_NONE</literal>, or
	    <literal>UNICODE_LB_ALLOWED</literal>, as described below.
	    The second parameter is
	    the opaque pointer that was passed to
	    <function>unicode_lb_init</function>(); the opaque pointer
	    is not subject to any further interpretation by these functions.
	  </para>

	  <para>
	    <function>unicode_lb_init</function>() returns an opaque handle.
	    Repeated invocations of <function>unicode_lb_next</function>(),
	    passing the handle and one unicode character at a time,
	    defines a sequence
	    of unicode characters over which the line breaking algorithm
	    calculation takes place.
	    <function>unicode_lb_next_cnt</function>() is a shortcut
	    for invoking <function>unicode_lb_next</function>()
	    repeatedly over an array
	    <literal>cptr</literal> containing
	    <literal>cnt</literal> unicode characters.
	  </para>

	  <para>
	    <function>unicode_lb_end</function>() denotes the end of the
	    unicode character sequence. After the call to
	    <function>unicode_lb_end</function>() the line breaking
	    <classname>unicode_lb_info_t</classname> handle is no longer valid.
	  </para>

	  <para>
	    Between the call to
	    <function>unicode_lb_init</function>() and
	    <function>unicode_lb_end</function>(), the callback function
	    gets invoked exactly once for each unicode character given to
	    <function>unicode_lb_next</function>() or
	    <function>unicode_lb_next_cnt</function>().
	    Usually each call to
	    <function>unicode_lb_next</function>() results in the callback
	    function getting invoked immediately, but it does not have to be.
	    It's possible that a call to <function>unicode_lb_next</function>()
	    returns without invoking the callback function, and some subsequent
	    call to <function>unicode_lb_next</function>() (or
	    <function>unicode_lb_end</function>()) invokes the callback function
	    more than once, to catch up.
	    The contract is that before <function>unicode_lb_end</function>()
	    returns, the callback function gets invoked the exact number of times
	    as the number of characters in the unicode sequence defined by
	    the intervening calls to <function>unicode_lb_next</function>() and
	    <function>unicode_lb_next_cnt</function>(), unless an error
	    occurs.
	  </para>

	  <para>
	    Each call to the callback function reports the calculated
	    line breaking status of the corresponding character in the unicode
	    character sequence:
	  </para>

	  <variablelist>
	    <varlistentry>
	      <term><literal>UNICODE_LB_MANDATORY</literal></term>
	      <listitem>
		<para>
		  A line break is MANDATORY
		  <emphasis>before</emphasis> the corresponding character.
		</para>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
	      <term><literal>UNICODE_LB_NONE</literal></term>
	      <listitem>
		<para>
		  A line break is PROHIBITED
		  <emphasis>before</emphasis> the corresponding character.
		</para>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
	      <term><literal>UNICODE_LB_ALLOWED</literal></term>
	      <listitem>
		<para>
		  A line break is OPTIONAL
		  <emphasis>before</emphasis> the corresponding character.
		</para>
	      </listitem>
	    </varlistentry>
	  </variablelist>

	  <para>
	    The callback function should return 0. A non-zero value
	    indicates to the line breaking algorithm that an error has
	    occured.
	    <function>unicode_lb_next</function>() and
	    <function>unicode_lb_next_cnt</function>() return zero either if
	    they never invoked the callback function, or if each call to the
	    callback function returned zero.
	    A non zero return from the callback function results in
	    <function>unicode_lb_next</function>() and
	    <function>unicode_lb_next_cnt</function>() immediately returning
	    the same value.
	  </para>

	  <para>
	    <function>unicode_lb_end</function>() must be invoked to destroy
	    the line breaking handle even if
	    <function>unicode_lb_next</function>() and
	    <function>unicode_lb_next_cnt</function>() returned an error
	    indication. It's also possible that, under normal circumstances,
	    <function>unicode_lb_end</function>() invokes the callback function
	    one or more times. The return value from
	    <function>unicode_lb_end</function>() has the same meaning as
	    from <function>unicode_lb_next</function>() and
	    <function>unicode_lb_next_cnt</function>(); however in all cases
	    after <function>unicode_lb_end</function>() returns the
	    line breaking handle is no longer valid.
	  </para>

	  <refsect2 id="unicode_lb_altcallback">
	    <title>Alternative callback function</title>

	    <para>
	      <function>unicode_lbc_init</function>(),
	      <function>unicode_lbc_next</function>(),
	      <function>unicode_lbc_next_cnt</function>(),
	      <function>unicode_lbc_end</function>() are alternative functions
	      that implement the same algorithm. The only difference is that
	      the callback function receives an extra parameter, the unicode
	      character value to which the line breaking status applies to,
	      passed through from the input unicode character sequence.
	    </para>
	  </refsect2>

	  <refsect2 id="unicode_lb_altcallback_opt">
	    <title>Options</title>

	    <para>
	      <function>unicode_lb_set_opts</function>() and
	      <function>unicode_lbc_set_opts</function>() enable non-default
	      options for the line breaking algorithm. These functions must be
	      called immediately after
	      <function>unicode_lb_init</function>() or
	      <function>unicode_lbc_init</function>(), and before any other
	      function.
	      <parameter>opts</parameter> is a bitmask that can contain
	      the following values:
	    </para>

	    <variablelist>
	      <varlistentry>
		<term><literal>UNICODE_LB_OPT_PRBREAK</literal></term>
		<listitem>
		  <para>
		    Enables a modified <literal>LB24</literal> rule.
		    This prevents
		    plus signs, as in <quote>C++</quote> from breaking. This
		    flag adds the following rules to the LB24 rule:
		  </para>

		  <blockquote>
		    <informalexample>
		      <programlisting>
			PR x PR

			AL x PR

		        ID x PR</programlisting>
		    </informalexample>
		  </blockquote>
		</listitem>
	      </varlistentry>
	      <varlistentry>
		<term><literal>UNICODE_LB_OPT_SYBREAK</literal></term>
		<listitem>
		  <para>
		    Tailored breaking rules for the <quote>/</quote> character.
		    This prevents breaking after the <quote>/</quote> character
		    (think URLs); including an exception to the
		    <quote>x SY</quote> rule in <literal>LB13</literal>.
		    This flag adds the following rules to the LB24 rule:
		  </para>
		  <blockquote>
		    <informalexample>
		      <programlisting>
			SY x EX

			SY x AL

			SY x ID

		        SP ÷ SY, which takes precedence over "x SY".</programlisting>
		    </informalexample>
		  </blockquote>
		</listitem>
	      </varlistentry>
	      <varlistentry>
		<term><literal>UNICODE_LB_OPT_DASHWJ</literal></term>
		<listitem>
		  <para>
		    This flag reclassifies <literal>U+2013</literal> and
		    <literal>U+2014</literal> as class <literal>WJ</literal>,
		    prohibiting breaks before and after the m-dash and the
		    n-dash unicode characters.
		  </para>
		</listitem>
	      </varlistentry>
	    </variablelist>
	  </refsect2>
	</refsect1>

	<refsect1 id="unicode_lb_seealso">
	  <title>SEE ALSO</title>

	  <para>
	    <link linkend="courier-unicode">
	      <citerefentry>
		<refentrytitle>courier-unicode</refentrytitle>
		<manvolnum>7</manvolnum></citerefentry></link>,
	    <link linkend="unicode__linebreak">
	      <citerefentry><refentrytitle>unicode::linebreak</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	    <ulink url="https://www.unicode.org/reports/tr14/tr14-&tr14ver;.html">TR-14</ulink>
	  </para>
	</refsect1>
      </refentry>

      <refentry id="unicode_script">
	<refentryinfo><author><firstname>Sam</firstname><surname>Varshavchik</surname><contrib>Author</contrib></author><productname>Courier Unicode Library</productname></refentryinfo>
	<refmeta>
	  <refentrytitle>unicode_script</refentrytitle>
	  <manvolnum>3</manvolnum>
	</refmeta>

	<refnamediv>
	  <refname>unicode_script</refname>
	  <refpurpose>unicode script property</refpurpose>
	</refnamediv>

	<refsynopsisdiv>
	  <funcsynopsis>
	    <funcsynopsisinfo>#include &lt;courier-unicode.h&gt;</funcsynopsisinfo>
	    <funcprototype>
              <funcdef>unicode_script_t <function>unicode_script</function></funcdef>
              <paramdef>char32_t <parameter>ch</parameter></paramdef>
	    </funcprototype>
	  </funcsynopsis>
	</refsynopsisdiv>
	<refsect1 id="unicode_script_descr">
	  <title>DESCRIPTION</title>
	  <para>
	    <function>unicode_script</function>() looks up the
	    <quote>script</quote> property of the specified unicode character,
	    and returns it. The <classname>unicode_script_t</classname>
	    enumeration encodes possible unicode script values.
	    <literal>unicode_script_unknown</literal> gets returned for a
	    unicode character  with an unknown script property.
	  </para>
	</refsect1>

	<refsect1 id="unicode_script_seealso">
	  <title>SEE ALSO</title>

	  <para>
	    <ulink url="https://www.unicode.org/reports/tr24/tr24-&tr24ver;.html">TR-24</ulink>,
	    <link linkend="courier-unicode">
	      <citerefentry>
		<refentrytitle>courier-unicode</refentrytitle>
		<manvolnum>7</manvolnum></citerefentry></link>.
	  </para>
	</refsect1>
      </refentry>

      <refentry id="unicode_word_break">
	<refentryinfo><author><firstname>Sam</firstname><surname>Varshavchik</surname><contrib>Author</contrib></author><productname>Courier Unicode Library</productname></refentryinfo>
	<refmeta>
	  <refentrytitle>unicode_word_break</refentrytitle>
	  <manvolnum>3</manvolnum>
	</refmeta>

	<refnamediv>
	  <refname>unicode_wb_init</refname>
	  <refname>unicode_wb_next</refname>
	  <refname>unicode_wb_next_cnt</refname>
	  <refname>unicode_wb_end</refname>

	  <refname>unicode_wbscan_init</refname>
	  <refname>unicode_wbscan_next</refname>
	  <refname>unicode_wbscan_end</refname>
	  <refname>unicode_word_break</refname>

	  <refpurpose>calculate word breaks</refpurpose>
	</refnamediv>

	<refsynopsisdiv>
	  <funcsynopsis>
	    <funcsynopsisinfo>#include &lt;courier-unicode.h&gt;</funcsynopsisinfo>
	    <funcprototype>
              <funcdef>unicode_wb_info_t <function>unicode_wb_init</function></funcdef>
              <paramdef>int (*<parameter>cb_func</parameter>)(int, void *)</paramdef>
              <paramdef>void *<parameter>cb_arg</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode_wb_next</function></funcdef>
              <paramdef>unicode_wb_info_t <parameter>wb</parameter></paramdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode_wb_next_cnt</function></funcdef>
              <paramdef>unicode_wb_info_t <parameter>wb</parameter></paramdef>
              <paramdef>const char32_t *<parameter>cptr</parameter></paramdef>
              <paramdef>size_t <parameter>cnt</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode_wb_end</function></funcdef>
              <paramdef>unicode_wb_info_t <parameter>wb</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>unicode_wbscan_info_t <function>unicode_wbscan_init</function></funcdef>
	      <void />
	    </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode_wbscan_next</function></funcdef>
              <paramdef>unicode_wbscan_info_t <parameter>wbs</parameter></paramdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>size_t <function>unicode_wbscan_end</function></funcdef>
              <paramdef>unicode_wbscan_info_t <parameter>wbs</parameter></paramdef>
	    </funcprototype>

	  </funcsynopsis>
	</refsynopsisdiv>
	<refsect1 id="unicode_wb_descr">
	  <title>DESCRIPTION</title>
	  <para>
	    These functions implement the unicode word breaking algorithm.
	    Invoke <function>unicode_wb_init</function>() to initialize the
	    word breaking algorithm. The
	    first parameter is a callback function.
	    The second parameter is an opaque pointer.
	    The callback function gets invoked with two parameters.
	    The second parameter is
	    the opaque pointer that was given to
	    <function>unicode_wb_init</function>(); and the opaque pointer
	    is not subject to any further interpretation by these functions.
	  </para>

	  <para>
	    <function>unicode_wb_init</function>() returns an opaque handle.
	    Repeated invocations of <function>unicode_wb_next</function>(),
	    passing the handle, and one unicode character defines a sequence
	    of unicode characters over which the word breaking algorithm
	    calculation takes place.
	    <function>unicode_wb_next_cnt</function>() is a shortcut
	    for invoking <function>unicode_wb_next</function>()
	    repeatedly over an array
	    <literal>cptr</literal> containing
	    <literal>cnt</literal> unicode characters.
	  </para>

	  <para>
	    <function>unicode_wb_end</function>() denotes the end of the
	    unicode character sequence. After the call to
	    <function>unicode_wb_end</function>() the word breaking
	    <classname>unicode_wb_info_t</classname> handle is no longer valid.
	  </para>

	  <para>
	    Between the call to
	    <function>unicode_wb_init</function>() and
	    <function>unicode_wb_end</function>(), the callback function
	    gets invoked exactly once for each unicode character given to
	    <function>unicode_wb_next</function>() or
	    <function>unicode_wb_next_cnt</function>().
	    Usually each call to
	    <function>unicode_wb_next</function>() results in the callback
	    function getting invoked immediately, but it does not have to be.
	    It's possible that a call to <function>unicode_wb_next</function>()
	    returns without invoking the callback function, and some subsequent
	    call to <function>unicode_wb_next</function>() (or
	    <function>unicode_wb_end</function>()) invokes the callback function
	    more than once, to catch things up.
	    The contract is that before <function>unicode_wb_end</function>()
	    returns, the callback function gets invoked the exact number of times
	    as the number of characters in the unicode sequence defined by
	    the intervening calls to <function>unicode_wb_next</function>() and
	    <function>unicode_wb_next_cnt</function>(), unless an error
	    occurs.
	  </para>

	  <para>
	    Each call to the callback function reports the calculated
	    wordbreaking status of the corresponding character in the unicode
	    character sequence. If the parameter to the callback function
	    is non zero, a word break is permitted <emphasis>before</emphasis>
	    the corresponding character. A zero value indicates that a word
	    break is prohibited <emphasis>before</emphasis> the corresponding
	    character.
	  </para>

	  <para>
	    The callback function should return 0. A non-zero value
	    indicates to the word breaking algorithm that an error has
	    occured.
	    <function>unicode_wb_next</function>() and
	    <function>unicode_wb_next_cnt</function>() return zero either if
	    they never invoked the callback function, or if each call to the
	    callback function returned zero.
	    A non zero return from the callback function results in
	    <function>unicode_wb_next</function>() and
	    <function>unicode_wb_next_cnt</function>() immediately returning
	    the same value.
	  </para>

	  <para>
	    <function>unicode_wb_end</function>() must be invoked to destroy
	    the word breaking handle even if
	    <function>unicode_wb_next</function>() and
	    <function>unicode_wb_next_cnt</function>() returned an error
	    indication. It's also possible that, under normal circumstances,
	    <function>unicode_wb_end</function>() invokes the callback function
	    one or more times. The return value from
	    <function>unicode_wb_end</function>() has the same meaning as
	    from <function>unicode_wb_next</function>() and
	    <function>unicode_wb_next_cnt</function>(); however in all cases
	    after <function>unicode_wb_end</function>() returns the
	    line breaking handle is no longer valid.
	  </para>

	  <refsect2 id="unicode_wb_scan">
	    <title>Word scan</title>

	    <para>
	      <function>unicode_wbscan_init</function>(),
              <function>unicode_wbscan_next</function>() and
              <function>unicode_wbscan_end</function>
	      scan for the next word boundary in a unicode character sequence.

	      <function>unicode_wbscan_init</function>() obtains a handle,
	      then
              <function>unicode_wbscan_next</function>() gets repeatedly invoked
	      to define the unicode character sequence.
	      <function>unicode_wbscan_end</function>() deallocates the handle
	      and returns the number of leading characters in the unicode character
	      sequence up to the first word break.
	    </para>

	    <para>
	      A non-0 return value from
              <function>unicode_wbscan_next</function>() indicates that the
	      word boundary is already known, and any further calls to
              <function>unicode_wbscan_next</function>() will be ignored.
	      <function>unicode_wbscan_end</function>() must still be called,
	      to obtain the unicode character count.
	    </para>
	  </refsect2>
	</refsect1>

	<refsect1 id="unicode_wb_seealso">
	  <title>SEE ALSO</title>
	  <para>
	    <ulink url="https://www.unicode.org/reports/tr29/tr29-&tr29ver;.html">TR-29</ulink>,
	    <link linkend="courier-unicode">
	      <citerefentry>
		<refentrytitle>courier-unicode</refentrytitle>
		<manvolnum>7</manvolnum></citerefentry></link>,
	    <link linkend="unicode_word_break">
	      <citerefentry><refentrytitle>unicode::wordbreak</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	      <link linkend="unicode_uc">
		<citerefentry><refentrytitle>unicode_convert_tocase</refentrytitle>
		<manvolnum>3</manvolnum></citerefentry></link>,
		<link linkend="unicode_line_break">
		  <citerefentry><refentrytitle>unicode_line_break</refentrytitle>
		  <manvolnum>3</manvolnum></citerefentry></link>,
		  <link linkend="unicode_grapheme_break">
		    <citerefentry><refentrytitle>unicode_grapheme_break</refentrytitle>
		    <manvolnum>3</manvolnum></citerefentry></link>.
	  </para>
	</refsect1>
      </refentry>

      <refentry id="unicode_uc">
	<refentryinfo><author><firstname>Sam</firstname><surname>Varshavchik</surname><contrib>Author</contrib></author><productname>Courier Unicode Library</productname></refentryinfo>
	<refmeta>
	  <refentrytitle>unicode_uc</refentrytitle>
	  <manvolnum>3</manvolnum>
	</refmeta>

	<refnamediv>
	  <refname>unicode_uc</refname>
	  <refname>unicode_lc</refname>
	  <refname>unicode_tc</refname>
	  <refname>unicode_convert_tocase</refname>
	  <refpurpose>unicode uppercase, lowercase, and titlecase character lookup</refpurpose>
	</refnamediv>

	<refsynopsisdiv>
	  <funcsynopsis>
	    <funcsynopsisinfo>#include &lt;courier-unicode.h&gt;</funcsynopsisinfo>
	    <funcprototype>
              <funcdef>char32_t <function>unicode_uc</function></funcdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>
	  </funcsynopsis>
	  <funcsynopsis>
	    <funcprototype>
              <funcdef>char32_t <function>unicode_lc</function></funcdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>
	  </funcsynopsis>
	  <funcsynopsis>
	    <funcprototype>
              <funcdef>char32_t <function>unicode_tc</function></funcdef>
              <paramdef>char32_t <parameter>c</parameter></paramdef>
	    </funcprototype>
	  </funcsynopsis>
	  <funcsynopsis>
	    <funcprototype>
              <funcdef>char *<function>unicode_convert_tocase</function></funcdef>
              <paramdef>const char *<parameter>str</parameter></paramdef>
              <paramdef>const char *<parameter>charset</parameter></paramdef>
              <paramdef>char32_t (*<parameter>first_char_func</parameter>)(uncode_char)</paramdef>
              <paramdef>char32_t (*<parameter>char_func</parameter>)(uncode_char)</paramdef>
	    </funcprototype>
	  </funcsynopsis>
	</refsynopsisdiv>
	<refsect1 id="unicode_uc_descr">
	  <title>DESCRIPTION</title>
	  <para>
	    <function>unicode_uc</function>(),
	    <function>unicode_lc</function>(),
	    <function>unicode_tc</function>()
	    return the uppercase, lowercase, or the titlecase
	    equivalent of the unicode character <parameter>c</parameter>.
	    If this character does not have an uppercase, lowercase, or a titlecase
	    equivalent, these functions return <parameter>c</parameter>, the
	    same character.
	  </para>

	  <para>
	    <function>unicode_convert_tocase</function>()
	    takes the string <parameter>str</parameter> in the
	    character set <parameter>charset</parameter>.
	    <parameter>first_char_func</parameter> and
	    <parameter>char_func</parameter>, each, should be
	    <function>unicode_uc</function>,
	    <function>unicode_lc</function>, or
	    <function>unicode_tc</function>.
	    <function>unicode_convert_tocase</function>() returns a malloc()ed
	    buffer. The first unicode character in
	    <parameter>str</parameter> gets processed by
	    <parameter>first_char_func</parameter>, and all other characters by
	    <parameter>char_func</parameter>.
	  </para>
	</refsect1>

	<refsect1 id="unicode_uc_seealso">
	  <title>SEE ALSO</title>
	  <para>
	    <link linkend="courier-unicode">
	      <citerefentry>
		<refentrytitle>courier-unicode</refentrytitle>
		<manvolnum>7</manvolnum></citerefentry></link>,
	    <link linkend="unicode_convert">
	      <citerefentry>
		<refentrytitle>unicode_convert</refentrytitle>
		<manvolnum>3</manvolnum></citerefentry></link>,
	      <link linkend="unicode_default_chset">
		<citerefentry><refentrytitle>unicode_default_chset</refentrytitle>
		<manvolnum>3</manvolnum></citerefentry></link>,
		<link linkend="unicode_html40ent_lookup">
		  <citerefentry><refentrytitle>unicode_html40ent_lookup</refentrytitle>
		  <manvolnum>3</manvolnum></citerefentry></link>,
		  <link linkend="unicode_category_lookup">
		    <citerefentry><refentrytitle>unicode_category_lookup</refentrytitle>
		    <manvolnum>3</manvolnum></citerefentry></link>,
		    <link linkend="unicode_grapheme_break">
		      <citerefentry><refentrytitle>unicode_grapheme_break</refentrytitle>
		      <manvolnum>3</manvolnum></citerefentry></link>,
		      <link linkend="unicode_word_break">
			<citerefentry><refentrytitle>unicode_word_break</refentrytitle>
			<manvolnum>3</manvolnum></citerefentry></link>,
			<link linkend="unicode_line_break">
			  <citerefentry><refentrytitle>unicode_line_break</refentrytitle>
			  <manvolnum>3</manvolnum></citerefentry></link>.

	  </para>
	</refsect1>
      </refentry>
    </section>

    <section id="manpagescpp">
      <title>C++ manual pages</title>

      <refentry id="unicode__bidi">
	<refentryinfo><author><firstname>Sam</firstname><surname>Varshavchik</surname><contrib>Author</contrib></author><productname>Courier Unicode Library</productname></refentryinfo>

	<refmeta>
	  <refentrytitle>unicode::bidi</refentrytitle>
	  <manvolnum>3</manvolnum>
	</refmeta>

	<refnamediv>
	  <refname>unicode::bidi</refname>
	  <refname>unicode::bidi_calc</refname>
	  <refname>unicode::bidi_calc_types</refname>
	  <refname>unicode::bidi_reorder</refname>
	  <refname>unicode::bidi_cleanup</refname>
	  <refname>unicode::bidi_logical_order</refname>
	  <refname>unicode::bidi_combinings</refname>
	  <refname>unicode::bidi_needs_embed</refname>
	  <refname>unicode::bidi_embed</refname>
	  <refname>unicode::bidi_embed_paragraph_level</refname>
	  <refname>unicode::bidi_get_direction</refname>
	  <refname>unicode::bidi_override</refname>
	  <refpurpose>unicode bi-directional algorithm</refpurpose>
	</refnamediv>

	<refsynopsisdiv>
	  <synopsis>#include &lt;courier-unicode.h&gt;</synopsis>
	  <classsynopsis class="class" language="C++">
	    <ooclass>
	      <classname>struct unicode::bidi_calc_types</classname>
	    </ooclass>
	    <constructorsynopsis>
	      <methodname>bidi_calc_types</methodname>
	      <methodparam><modifier>const std::u32string &amp;</modifier><parameter>string</parameter>
	      </methodparam>
	    </constructorsynopsis>
	    <fieldsynopsis>
	      <modifier>std::vector&lt;unicode_bidi_type_t&gt;</modifier>
	      <varname>types</varname>
	    </fieldsynopsis>

	    <methodsynopsis>
	      <void />
	      <methodname>setbnl</methodname>
	      <methodparam>
		<modifier>std::u32string &amp;</modifier>
		<parameter>string</parameter>
	      </methodparam>
	    </methodsynopsis>
	  </classsynopsis>

	  <funcsynopsis>
	    <funcprototype>
              <funcdef>std::tuple&lt;std::vector&lt;unicode_bidi_level_t&gt;, struct unicode_bidi_direction&gt; <function>unicode::bidi_calc</function></funcdef>
	      <paramdef>const unicode::bidi_calc_types &amp;<parameter>ustring</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>std::tuple&lt;std::vector&lt;unicode_bidi_level_t&gt;, struct unicode_bidi_direction&gt; <function>unicode::bidi_calc</function></funcdef>
	      <paramdef>const unicode::bidi_calc_types &amp;<parameter>ustring</parameter></paramdef>
	      <paramdef>unicode_bidi_level_t <parameter>embedding_level</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode::bidi_reorder</function></funcdef>
	      <paramdef>std::u32string &amp;<parameter>string</parameter></paramdef>
	      <paramdef>std::vector&lt;unicode_bidi_level_t&gt; &amp;<parameter>embedding_level</parameter></paramdef>
	      <paramdef>const std::function&lt;void (size_t, size_t)&gt; &amp;<parameter>reorder_callback</parameter>=[](size_t, size_t){}</paramdef>
	      <paramdef>size_t <parameter>starting_pos</parameter>=0</paramdef>
	      <paramdef>size_t <parameter>n</parameter>=(size_t)-1</paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>void <function>unicode::bidi_reorder</function></funcdef>
	      <paramdef>std::vector&lt;unicode_bidi_level_t&gt; &amp;<parameter>embedding_level</parameter></paramdef>
	      <paramdef>const std::function&lt;void (size_t, size_t)&gt; &amp;<parameter>reorder_callback</parameter>=[](size_t, size_t){}</paramdef>
	      <paramdef>size_t <parameter>starting_pos</parameter>=0</paramdef>
	      <paramdef>size_t <parameter>n</parameter>=(size_t)-1</paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>void <function>unicode::bidi_cleanup</function></funcdef>
	      <paramdef>std::u32string &amp;<parameter>string</parameter></paramdef>
	      <paramdef>const std::function&lt;void (size_t)&gt; &amp;<parameter>removed_callback</parameter>=[](size_t){}</paramdef>
	      <paramdef>int <parameter>cleanup_options</parameter></paramdef>
            </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode::bidi_cleanup</function></funcdef>
	      <paramdef>std::u32string &amp;<parameter>string</parameter></paramdef>
	      <paramdef>std::vector &lt;unicode_bidi_level_t&gt; &amp;<parameter>levels</parameter></paramdef>
	      <paramdef>const std::function&lt;void (size_t)&gt; &amp;<parameter>removed_callback</parameter>=[](size_t){}</paramdef>
	      <paramdef>int <parameter>cleanup_options</parameter>=0</paramdef>
            </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode::bidi_cleanup</function></funcdef>
	      <paramdef>std::u32string &amp;<parameter>string</parameter></paramdef>
	      <paramdef>std::vector &lt;unicode_bidi_level_t&gt; &amp;<parameter>levels</parameter></paramdef>
	      <paramdef>const std::function&lt;void (size_t)&gt; &amp;<parameter>removed_callback</parameter></paramdef>
	      <paramdef>int <parameter>cleanup_options</parameter></paramdef>
	      <paramdef>size_t <parameter>starting_pos</parameter></paramdef>
	      <paramdef>size_t <parameter>n</parameter></paramdef>
            </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode::bidi_logical_order</function></funcdef>
	      <paramdef>std::u32string &amp;<parameter>string</parameter></paramdef>
	      <paramdef>std::vector &lt;unicode_bidi_level_t&gt; &amp;<parameter>levels</parameter></paramdef>
	      <paramdef>unicode_bidi_level_t <parameter>paragraph_embedding</parameter></paramdef>
	      <paramdef>const std::function&lt;void (size_t, size_t)&gt; &amp;<parameter>reorder_callback</parameter>=[](size_t, size_t){}</paramdef>
	      <paramdef>size_t <parameter>starting_pos</parameter>=0</paramdef>
	      <paramdef>size_t <parameter>n</parameter>=(size_t)-1</paramdef>
            </funcprototype>

	    <funcprototype>
              <funcdef>void <function>unicode::bidi_combinings</function></funcdef>
	      <paramdef>const std::u32string &amp;<parameter>string</parameter></paramdef>
	      <paramdef>const std::vector &lt;unicode_bidi_level_t&gt; &amp;<parameter>levels</parameter></paramdef>
	      <paramdef>const std::function &lt;void (unicode_bidi_level_t level, size_t level_start, size_t n_chars, size_t comb_start, size_t n_comb_chars)&gt; &amp;<parameter>callback</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>void <function>unicode::bidi_combinings</function></funcdef>
	      <paramdef>const std::u32string &amp;<parameter>string</parameter></paramdef>
	      <paramdef>const std::function &lt;void (unicode_bidi_level_t level, size_t level_start, size_t n_chars, size_t comb_start, size_t n_comb_chars)&gt; &amp;<parameter>callback</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>void <function>unicode::bidi_logical_order</function></funcdef>
	      <paramdef>std::vector &lt;unicode_bidi_level_t&gt; &amp;<parameter>levels</parameter></paramdef>
	      <paramdef>unicode_bidi_level_t <parameter>paragraph_embedding</parameter></paramdef>
	      <paramdef>const std::function&lt;void (size_t, size_t)&gt; &amp;<parameter>reorder_callback</parameter></paramdef>
	      <paramdef>size_t <parameter>starting_pos</parameter>=0</paramdef>
	      <paramdef>size_t <parameter>n</parameter>=(size_t)-1</paramdef>
            </funcprototype>

	    <funcprototype>
              <funcdef>bool <function>unicode::bidi_needs_embed</function></funcdef>
	      <paramdef>const std::u32string &amp;<parameter>string</parameter></paramdef>
	      <paramdef>const std::vector &lt;unicode_bidi_level_t&gt; &amp;<parameter>levels</parameter></paramdef>
	      <paramdef>const unicode_bidi_level_t (<parameter>paragraph_embedding</parameter>=NULL</paramdef>
	      <paramdef>size_t <parameter>starting_pos</parameter>=0</paramdef>
	      <paramdef>size_t <parameter>n</parameter>=(size_t)-1</paramdef>
            </funcprototype>

	    <funcprototype>
              <funcdef>int <function>unicode::bidi_embed</function></funcdef>
	      <paramdef>const std::u32string &amp;<parameter>string</parameter></paramdef>
	      <paramdef>const std::vector &lt;unicode_bidi_level_t&gt; &amp;<parameter>levels</parameter></paramdef>
	      <paramdef>unicode_bidi_level_t <parameter>paragraph_embedding</parameter></paramdef>
	      <paramdef>const std::function&lt;void (const char32_t *, size_t, bool)&gt; &amp;<parameter>callback</parameter></paramdef>
            </funcprototype>

	    <funcprototype>
              <funcdef>std::u32string <function>unicode::bidi_embed</function></funcdef>
	      <paramdef>const std::u32string &amp;<parameter>string</parameter></paramdef>
	      <paramdef>const std::vector &lt;unicode_bidi_level_t&gt; &amp;<parameter>levels</parameter></paramdef>
	      <paramdef>unicode_bidi_level_t <parameter>paragraph_embedding</parameter></paramdef>
            </funcprototype>

	    <funcprototype>
	      <funcdef>char32_t <function>unicode_bidi_embed_paragraph_level</function></funcdef>
              <paramdef>const std::u32string &amp;<parameter>string</parameter></paramdef>
              <paramdef>unicode_bidi_level_t <parameter>paragraph_embedding</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>unicode_bidi_direction <function>bidi_get_direction</function></funcdef>
              <paramdef>const std::u32string &amp;<parameter>string</parameter></paramdef>
	      <paramdef>size_t <parameter>starting_pos</parameter>=0</paramdef>
	      <paramdef>size_t <parameter>n</parameter>=(size_t)-1</paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>std::u32string <function>bidi_override</function></funcdef>
              <paramdef>const std::u32string &amp;<parameter>string</parameter></paramdef>
              <paramdef>unicode_bidi_level_t <parameter>direction</parameter></paramdef>
	      <paramdef>int <parameter>cleanup_options</parameter>=0</paramdef>
	    </funcprototype>
          </funcsynopsis>
	</refsynopsisdiv>

	<refsect1 id="unicode_cpp_bidi_descr">
	  <title>DESCRIPTION</title>

	  <para>
	    These functions implement the C++ interface for the
	    <ulink url="https://www.unicode.org/reports/tr9/tr9-&tr9ver;.html"> Unicode Bi-Directional algorithm</ulink>.
	    See the description of the underlying
	    <link linkend="unicode_bidi">
	      <citerefentry><refentrytitle>unicode_bidi</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link> C library
	      API for more information. C++ specific notes:
	  </para>

	  <itemizedlist>
	    <listitem>
	      <para>
                <function>unicode::bidi_calc</function> returns the
		directional embedding value buffer and the calculated paragraph
		embedding level. Its <parameter>ustring</parameter>
		is implicitly converted from a
		<classname>std::u32string</classname>:
              </para>
	      <blockquote>
		<informalexample>
		  <programlisting><![CDATA[
std::u32string text;

auto [levels, direction]=unicode::bidi_calc(text);

]]></programlisting>
		</informalexample>
	      </blockquote>

	      <para>
		Alternatively a <classname>unicode::bidi_calc_types</classname>
		objects gets constructed from the same
		<classname>std::u32string</classname> and then passed
		directly to <function>unicode::bidi_calc</function>:
	      </para>
	      <blockquote>
		<informalexample>
		  <programlisting><![CDATA[
std::u32string text;

unicode::bidi_calc_types types{text};

types.setbnl(text); // Optional

// types.types is a std::vector of enum_bidi_types_t values

auto [levels, direction]=unicode::bidi_calc(types);

]]></programlisting>
		</informalexample>
	      </blockquote>
	      <para>
		This provides the means to access the intermediate
		<classname>enum_bidi_types_t</classname> values that
		get calculated from the Unicode text string.
	      </para>

	      <note>
		<para>
		  In all cases the <classname>std::u32string</classname>
		  cannot be a temporary object, and it must remain in scope
		  until <function>unicode::bidi_calc</function>() returns.
		</para>
	      </note>

	      <para>
		The optional <methodname>setbnl</methodname>() method uses
		<link linkend="unicode_bidi">
		<citerefentry>
		  <refentrytitle>unicode_bidi_setbnl</refentrytitle>
		<manvolnum>3</manvolnum></citerefentry></link>
		to replace paragraph separators with newline characters,
		in the unicode string. It requires the same unicode string
		that was passed to the constructor as a parameter (because
		the constructor takes a constant reference, but this
		method modifies the string.
	      </para>
            </listitem>
	    <listitem>
	      <para>
		Several C functions provide a <quote>dry-run</quote> mode
		by passing a <literal>NULL</literal> pointer. The C++ API
		provides separate overloads, with and without the nullable
		parameter.
              </para>
            </listitem>
	    <listitem>
	      <para>
		Several C functions accept a nullable function pointer, with
		the <literal>NULL</literal> function pointer specifying no
		callback. The C++ functions have a
		<classname>std::function</classname> parameter with a
		default do-nothing closure.
              </para>
            </listitem>

	    <listitem>
	      <para>
		Several C functions accept two parameters, a Unicode character
		pointer and the embedding level buffer, and a single parameter
		that specifies the size of both.
		The equivalent C++ function takes two discrete parameters,
		a <classname>std::u32string</classname> and a
		<classname>std::vector</classname> and returns an
		<classname>int</classname>; a negative value if their sizes
		differ, and 0 if their sizes match, and the requested function
		completes. The <function>unicode::bidi_embed</function> overload
		that returns a <classname>std::u32string</classname> returns
		an empty string in case of a mismatch.
              </para>
            </listitem>

	    <listitem>
	      <para>
		<function>unicode::bidi_reorder</function>
		reorders the entire <parameter>string</parameter> and its
		<parameter>embedding_level</parameter>s by default.
		The optional
		<parameter>starting_pos</parameter> and
		<parameter>n</parameter> parameters limit the reordering
		to the indicated subset of the original string (specified
		as the starting position offset index, and the number of
		characters).
	      </para>
	    </listitem>

	    <listitem>
	      <para>
		<function>unicode::bidi_reorder</function>,
		<function>unicode::bidi_cleanup</function>,
		<function>unicode::bidi_logical_order</function>,
		<function>unicode::bidi_needs_embed</function> and
		<function>unicode::bidi_get_direction</function>
		take two optional
		parameters (defaulted values or overloaded) specifying
		an optional starting position and number of characters that
		define a subset of the original string that gets reordered,
		cleaned up, or has its direction determined.
	      </para>

	      <para>
		This <function>unicode::bidi_cleanup</function> does not
		trim off the passed in string and embedding level buffer,
		since it affects only a subset of the string. The number
		of times the removed character callback gets invoked
		indicates how much the substring should be trimmed off.
	      </para>
	    </listitem>

	    <listitem>
	      <para>
		<function>unicode::bidi_override</function>
		modifies the passed-in <parameter>string</parameter> as
		follows:
	      </para>

	      <itemizedlist>
		<listitem>
		  <para>
		    <function>unicode::bidi_cleanup</function>() is applied
		    with the specified, or defaulted,
		    <replaceable>cleanup_options</replaceable>
		  </para>
		</listitem>

		<listitem>
		  <para>
		    Either the <literal>LRO</literal> or an
		    <literal>RLO</literal> override marker gets prepended
		    to the Unicode string, forcing the entire string to
		    be interpreted in a single rendering direction, when
		    processed by the Unicode bi-directional algorithm.
		  </para>
		</listitem>
	      </itemizedlist>

	      <para>
		<function>unicode::bidi_override</function> makes it
		possible to use a Unicode-aware application or algorithm
		in a context that only works with text that's always
		displayed in a fixed direction, allowing graceful handling
		of input containing bi-directional text.
	      </para>
	    </listitem>
          </itemizedlist>

	  <refsect2 id="unicode_cpp_bidi_literals">
	    <title><literal>unicode::literals</literal> namespace</title>

	    <blockquote>
	      <informalexample>
		<programlisting><![CDATA[
using namespace unicode::literals;

std::u32string foo(std::u32string bar)
{
	return bar + LRO;
}
]]></programlisting>
	      </informalexample>
	    </blockquote>

	    <para>
	      This namespace contains the following <literal>constexpr</literal>
	      definitions:
	    </para>

	    <itemizedlist>
	      <listitem>
		<para>
		  <classname>char32_t</classname> arrays with literal
		  Unicode character strings containing Unicode directional,
		  isolate, and override markers, like
		  <literal>LRO</literal>,
		  <literal>RLO</literal> and others.
		</para>
	      </listitem>
	      <listitem>
		<para>
		  <literal>CLEANUP_EXTRA</literal>,
		  <literal>CLEANUP_BNL</literal>, and
		  <literal>CLEANUP_CANONICAL</literal> options for
		  <function>unicode::bidi_cleanup</function>().
		</para>
	      </listitem>
	    </itemizedlist>

	  </refsect2>
	</refsect1>

	<refsect1 id="unicode_cpp_bidi_seealso">
	  <title>SEE ALSO</title>
	  <para>
	    <link linkend="courier-unicode">
	      <citerefentry>
		<refentrytitle>courier-unicode</refentrytitle>
		<manvolnum>7</manvolnum></citerefentry></link>,
	    <link linkend="unicode_bidi">
	      <citerefentry><refentrytitle>unicode_bidi</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>.
          </para>
        </refsect1>
      </refentry>

      <refentry id="unicode__canonical">
	<refentryinfo><author><firstname>Sam</firstname><surname>Varshavchik</surname><contrib>Author</contrib></author><productname>Courier Unicode Library</productname></refentryinfo>

	<refmeta>
	  <refentrytitle>unicode::canonical</refentrytitle>
	  <manvolnum>3</manvolnum>
	</refmeta>

	<refnamediv>
	  <refname>unicode::canonical</refname>
	  <refname>unicode::decompose</refname>
	  <refname>unicode::decompose_default_reallocate</refname>
	  <refname>unicode::compose</refname>
	  <refname>unicode::compose_default_callback</refname>

	  <refpurpose>unicode canonical normalization and denormalization</refpurpose>
	</refnamediv>

	<refsynopsisdiv>
	  <funcsynopsis>
	    <funcsynopsisinfo>#include &lt;courier-unicode.h&gt;

constexpr int decompose_flag_qc=UNICODE_DECOMPOSE_FLAG_QC;
constexpr int decompose_flag_compat=UNICODE_DECOMPOSE_FLAG_COMPAT;

constexpr int compose_flag_removeunused=UNICODE_COMPOSE_FLAG_REMOVEUNUSED;
constexpr int compose_flag_oneshot=UNICODE_COMPOSE_FLAG_ONESHOT;</funcsynopsisinfo>

	    <funcprototype>
	      <funcdef>void <funcname>decompose_default_reallocate</funcname></funcdef>
	      <paramdef>std::u32string &amp;<parameter>string</parameter></paramdef>
	      <paramdef>const std::vector&lt;std::tuple&lt;size_t, size_t&gt;&gt; &amp;<parameter>list</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>void <funcname>decompose</funcname></funcdef>
	      <paramdef>std::u32string &amp;<parameter>string</parameter></paramdef>
	      <paramdef>int <parameter>flags</parameter>=0</paramdef>
	      <paramdef>const std::function&lt;void (std::u32string &amp;, const std::vector&lt;std::tuple&lt;size_t, size_t&gt;&gt;)&gt; &amp;<parameter>reallocate</parameter>=decompose_default_reallocate</paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>void <funcname>compose_default_callback</funcname></funcdef>
	      <paramdef>unicode_composition_t &amp;<parameter>compositions</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
	      <funcdef>void <funcname>compose</funcname></funcdef>
	      <paramdef>std::u32string &amp;<parameter>string</parameter></paramdef>
	      <paramdef>int <parameter>flags</parameter>=0</paramdef>
	      <paramdef>const std::function&lt;void (unicode_composition_t &amp;)&gt; &amp;<parameter>cb</parameter>=compose_default_reallocate</paramdef>
	    </funcprototype>
	  </funcsynopsis>
	</refsynopsisdiv>

	<refsect1 id="unicode_cpp_canonical_descr">
	  <title>DESCRIPTION</title>

	  <para>
	    These functions implement the C++ interface for the
	    <ulink url="https://www.unicode.org/reports/tr15/tr15-&tr15ver;.html">Unicode Canonical Decomposition and Composition</ulink>,
	    See the description of the underlying
	    <link linkend="unicode_canonical">
	      <citerefentry><refentrytitle>unicode_canonical</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link> C library
	      API for more information. C++ specific notes:
	  </para>

	  <itemizedlist>
	    <listitem>
	      <para>
		The C++ decomposition <parameter>reallocate</parameter> callback
		receives a single vector of <replaceable>offset</replaceable>
		and
		<replaceable>size</replaceable> tuples instead of two separate
		arrays or vectors.
		<function>unicode::decompose_default_reallocate</function>() is
		the C++ version of the default
		<varname>reallocate</varname> callback. It receives the
		receiving the same tuple vector parameter, too.
		The C++ interface use <classname>std::u32string</classname>s
		to represent Unicode text strings, and
		<function>unicode::decompose_default_reallocate</function>()
		<function>resize</function>s it.
	      </para>

	      <para>
		Like the C callback, the C++ one gets called 0 or more times.
	      </para>
	    </listitem>

	    <listitem>
	      <para>
		<function>unicode::compose</function>() takes care of
		initializing, applying, and de-initialization
		the <classname>unicode_composition_t</classname> object,
		for decomposition.
		The callback receives a reference to the
		<classname>unicode_composition_t</classname> object, which
		the callback should not modify in any way.
	      </para>
	    </listitem>
	  </itemizedlist>
	</refsect1>
	<refsect1 id="unicode_cpp_canonical_seealso">
	  <title>SEE ALSO</title>
	  <para>
	    <link linkend="courier-unicode">
	      <citerefentry>
		<refentrytitle>courier-unicode</refentrytitle>
		<manvolnum>7</manvolnum></citerefentry></link>,
	    <link linkend="unicode_canonical">
	      <citerefentry>
		<refentrytitle>unicode_canonical</refentrytitle>
		<manvolnum>3</manvolnum></citerefentry></link>.
	  </para>
	</refsect1>
      </refentry>
      <refentry id="unicode__iconvert__convert">
	<refentryinfo><author><firstname>Sam</firstname><surname>Varshavchik</surname><contrib>Author</contrib></author><productname>Courier Unicode Library</productname></refentryinfo>

	<refmeta>
	  <refentrytitle>unicode::iconvert::convert</refentrytitle>
	  <manvolnum>3</manvolnum>
	</refmeta>

	<refnamediv>
	  <refname>unicode::iconvert::convert</refname>
	  <refname>unicode::ucs_4</refname>
	  <refname>unicode::ucs_2</refname>
	  <refname>unicode::utf_8</refname>
	  <refname>unicode::iso_8859_1</refname>

	  <refpurpose>unicode character set conversion</refpurpose>
	</refnamediv>

	<refsynopsisdiv>
	  <funcsynopsis>
	    <funcsynopsisinfo>#include &lt;courier-unicode.h&gt;

extern const char unicode::ucs_4[];
extern const char unicode::ucs_2[];
extern const char unicode::utf_8[];
extern const char unicode::iso_8859_1[];</funcsynopsisinfo>

	    <funcprototype>
              <funcdef>std::string <function>unicode::iconvert::convert</function></funcdef>
              <paramdef>const std::string &amp;<parameter>text</parameter></paramdef>
              <paramdef>const std::string &amp;<parameter>srccharset</parameter></paramdef>
              <paramdef>const std::string &amp;<parameter>dstcharset</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>std::string <function>unicode::iconvert::convert</function></funcdef>
              <paramdef>const std::string &amp;<parameter>text</parameter></paramdef>
              <paramdef>const std::string &amp;<parameter>srccharset</parameter></paramdef>
              <paramdef>const std::string &amp;<parameter>dstcharset</parameter></paramdef>
              <paramdef>bool &amp;<parameter>errflag</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>std::string <function>unicode::iconvert::convert</function></funcdef>
              <paramdef>const std::vector&lt;char32_t&gt; &amp;<parameter>text</parameter></paramdef>
              <paramdef>const std::string &amp;<parameter>dstcharset</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>std::string <function>unicode::iconvert::convert</function></funcdef>
              <paramdef>const std::vector&lt;char32_t&gt; &amp;<parameter>text</parameter></paramdef>
              <paramdef>const std::string &amp;<parameter>dstcharset</parameter></paramdef>
              <paramdef>bool &amp;<parameter>errflag</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>bool <function>unicode::iconvert::convert</function></funcdef>
              <paramdef>const std::string &amp;<parameter>text</parameter></paramdef>
              <paramdef>const std::string &amp;<parameter>charset</parameter></paramdef>
              <paramdef>std::vector&lt;char32_t&gt; &amp;<parameter>text</parameter></paramdef>
	    </funcprototype>
	  </funcsynopsis>
	</refsynopsisdiv>

	<refsect1 id="unicode_cpp_convert_descr">
	  <title>DESCRIPTION</title>

	  <para>
	    The overloaded
	    <function>unicode::convert::convert</function>() functions
	    convert:
	  </para>

	  <itemizedlist>
	    <listitem>
	      <para>
		A text string between two different character sets, returning
		the new string.
	      </para>
	    </listitem>

	    <listitem>
	      <para>
		A vector of unicode characters (not null-terminated) to
		a character string in a supported character set.
	      </para>
	    </listitem>

	    <listitem>
	      <para>
		Initialize a vector of unicode characters, passed by
		reference, by converting a text string in a given character
		set to unicode.
	      </para>
	    </listitem>
	  </itemizedlist>

	  <para>
	    These functions use
	    <citerefentry><refentrytitle>iconv</refentrytitle>
	    <manvolnum>3</manvolnum></citerefentry>, and can use any
	    character set that's supported by
	    <citerefentry><refentrytitle>iconv</refentrytitle>
	    <manvolnum>3</manvolnum></citerefentry>.

	    Use
	    <varname>unicode::ucs_2</varname> and
	    <varname>unicode::ucs_4</varname> to specify the 16 and the 32 bit
	    unicode octet in native byte order.
	    Use
	    <varname>unicode::utf_8</varname> and
	    <varname>unicode::iso_8859_1</varname> to specify these two
	    standard character sets.

	    The overloaded versions that pass a reference to a
	    <classname>bool</classname> set the flag to <literal>true</literal>
	    if some characters could not be converted.
	    The overloaded version that initializes a unicode vector returns
	    the <classname>bool</classname> flag, instead.
	  </para>
	</refsect1>

	<refsect1 id="unicode_cpp_convert_seealso">
	  <title>SEE ALSO</title>
	  <para>
	    <link linkend="courier-unicode">
	      <citerefentry>
		<refentrytitle>courier-unicode</refentrytitle>
		<manvolnum>7</manvolnum></citerefentry></link>,
	    <link linkend="unicode__iconvert__convert_tocase">
	      <citerefentry><refentrytitle>unicode::convert::convert_tocase</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	    <link linkend="unicode_convert">
	      <citerefentry><refentrytitle>unicode_convert</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	      <ulink url="https://manpages.courier-mta.org/htmlman3/iconv.3.html">
	      <citerefentry><refentrytitle>iconv</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></ulink>.

	  </para>
	</refsect1>
      </refentry>

      <refentry id="unicode__iconvert__convert_tocase">
	<refentryinfo><author><firstname>Sam</firstname><surname>Varshavchik</surname><contrib>Author</contrib></author><productname>Courier Unicode Library</productname></refentryinfo>

	<refmeta>
	  <refentrytitle>unicode::iconvert::convert_tocase</refentrytitle>
	  <manvolnum>3</manvolnum>
	</refmeta>

	<refnamediv>
	  <refname>unicode::iconvert::convert_tocase</refname>

	  <refpurpose>unicode uppercase, lowercase, and titlecase conversion</refpurpose>
	</refnamediv>

	<refsynopsisdiv>
	  <funcsynopsis>
	    <funcsynopsisinfo>#include &lt;courier-unicode.h&gt;</funcsynopsisinfo>

	    <funcprototype>
              <funcdef>std::string <function>unicode::iconvert::convert_tocase</function></funcdef>
              <paramdef>const std::string &amp;<parameter>text</parameter></paramdef>
              <paramdef>const std::string &amp;<parameter>charset</parameter></paramdef>
              <paramdef>char32_t (*<parameter>first_char_func</parameter>)(char32_t)</paramdef>
              <paramdef>char32_t (*<parameter>char_func</parameter>)(char32_t)</paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>std::string <function>unicode::iconvert::convert_tocase</function></funcdef>
              <paramdef>const std::string &amp;<parameter>text</parameter></paramdef>
              <paramdef>const std::string &amp;<parameter>charset</parameter></paramdef>
              <paramdef>bool &amp;<parameter>err</parameter></paramdef>
              <paramdef>char32_t (*<parameter>first_char_func</parameter>)(char32_t)</paramdef>
              <paramdef>char32_t (*<parameter>char_func</parameter>)(char32_t)</paramdef>
	    </funcprototype>
	  </funcsynopsis>
	</refsynopsisdiv>

	<refsect1 id="unicode_cpp_convert_tocase_descr">
	  <title>DESCRIPTION</title>

	  <para>
	    The overloaded
	    <function>unicode::convert::convert_tocase</function>() function
	    converts the <parameter>text</parameter> parameter, in the
	    <parameter>charset</parameter> characters to lowercase, uppercase,
	    and titlecase. <parameter>text</parameter> gets converted,
	    internally, into unicode.
            <parameter>first_char_func</parameter> and
            <parameter>char_func</parameter> are either:
	    <function>unicode_lc</function>,
	    <function>unicode_uc</function>, or
	    <function>unicode_tc</function>. If the converted text string is
	    not empty, <parameter>first_char_func</parameter> converts the
	    first unicode character in the text string, and
            <parameter>char_func</parameter> converts any remaining characters.
	    <function>unicode_lc</function> converts its character to lowercase,
	    <function>unicode_uc</function> to uppercase, and
	    <function>unicode_tc</function> to titlecase. Finally, the
	    unicode string gets converted back to
	    <parameter>charset</parameter>, which gets returned.
	  </para>

	  <para>
	    The optional <parameter>err</parameter> parameter gets set to true if
	    an error was encounted converting the text string to or from
	    unicode.
	  </para>
	</refsect1>

	<refsect1 id="unicode_cpp_convert_tocase_seealso">
	  <title>SEE ALSO</title>
	  <para>
	    <link linkend="courier-unicode">
	      <citerefentry>
		<refentrytitle>courier-unicode</refentrytitle>
		<manvolnum>7</manvolnum></citerefentry></link>,
	    <link linkend="unicode__iconvert__convert">
	      <citerefentry><refentrytitle>unicode::convert::convert</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	    <link linkend="unicode_convert">
	      <citerefentry><refentrytitle>unicode_convert</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	      <ulink url="https://manpages.courier-mta.org/htmlman3/iconv.3.html">
	      <citerefentry><refentrytitle>iconv</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></ulink>.

	  </para>
	</refsect1>
      </refentry>

      <refentry id="unicode__iconvert__fromu">
	<refentryinfo><author><firstname>Sam</firstname><surname>Varshavchik</surname><contrib>Author</contrib></author><productname>Courier Unicode Library</productname></refentryinfo>

	<refmeta>
	  <refentrytitle>unicode::iconvert::fromu</refentrytitle>
	  <manvolnum>3</manvolnum>
	</refmeta>

	<refnamediv>
	  <refname>unicode::iconvert::fromu</refname>

	  <refpurpose>template for converting text sequence from unicode</refpurpose>
	</refnamediv>

	<refsynopsisdiv>
	  <funcsynopsis>
	    <funcsynopsisinfo>#include &lt;courier-unicode.h&gt;</funcsynopsisinfo>

	    <funcprototype>
              <funcdef>output_iter_t <function>unicode::iconvert::fromu::convert</function></funcdef>
              <paramdef>input_iter_t <parameter>beg_iter</parameter></paramdef>
              <paramdef>input_iter_t <parameter>end_iter</parameter></paramdef>
              <paramdef>const std::string &amp;<parameter>charset</parameter></paramdef>
              <paramdef>output_iter_t <parameter>output_iter</parameter></paramdef>
              <paramdef>bool &amp;<parameter>errflag</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>void <function>unicode::iconvert::fromu::convert</function></funcdef>
              <paramdef>input_iter_t <parameter>beg_iter</parameter></paramdef>
              <paramdef>input_iter_t <parameter>end_iter</parameter></paramdef>
              <paramdef>const std::string &amp;<parameter>charset</parameter></paramdef>
              <paramdef>std::string &amp;<parameter>out_buf</parameter></paramdef>
              <paramdef>bool &amp;<parameter>errflag</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>std::pair&lt;std::string, bool&gt; <function>unicode::iconvert::fromu::convert</function></funcdef>
              <paramdef>const std::u32string &amp;<parameter>text</parameter></paramdef>
              <paramdef>const std::string &amp;<parameter>charset</parameter></paramdef>
	    </funcprototype>
	  </funcsynopsis>
	</refsynopsisdiv>

	<refsect1 id="unicode_cpp_convert_fromu_descr">
	  <title>DESCRIPTION</title>

	  <para>
	    These template functions convert unicode characters to
	    text in the given character set.
	    <parameter>beg_iter</parameter> and
	    <parameter>end_iter</parameter> define an input sequence of
	    <classname>char32_t</classname>s.
	    They get converted to unicode characters.
	    <parameter>output_iter</parameter> is an output iterator that
	    <function>convert</function>()
	    iterates over <classname>char</classname>s in the specified
	    character set.
	    <function>convert</function>() returns the value of the output
	    iterator after iterating over the converted character sequence.
	    <parameter>err_flag</parameter> gets set to <literal>true</literal>
	    if unicode text could not be converted to the requested character
	    set, or <literal>false</literal> for a successful conversion.
	  </para>

	  <para>
	    An overloaded <function>convert</function>() puts the text string
	    into a <classname>std::string</classname>, instead of using
	    an output iterator.
	    Finally, a single
	    <classname>std::u32string</classname>
	    specifies the character string, instead of a beginning and an
	    ending iterator.
	  </para>
	</refsect1>

	<refsect1 id="unicode_cpp_convert_fromu_seealso">
	  <title>SEE ALSO</title>
	  <para>
	    <link linkend="courier-unicode">
	      <citerefentry>
		<refentrytitle>courier-unicode</refentrytitle>
		<manvolnum>7</manvolnum></citerefentry></link>,
	    <link linkend="unicode__iconvert__convert">
	      <citerefentry><refentrytitle>unicode::convert::convert</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	    <link linkend="unicode_convert">
	      <citerefentry><refentrytitle>unicode_convert</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	      <ulink url="https://manpages.courier-mta.org/htmlman3/iconv.3.html">
	      <citerefentry><refentrytitle>iconv</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></ulink>.

	  </para>
	</refsect1>
      </refentry>

      <refentry id="unicode__iconvert__tou">
	<refentryinfo><author><firstname>Sam</firstname><surname>Varshavchik</surname><contrib>Author</contrib></author><productname>Courier Unicode Library</productname></refentryinfo>

	<refmeta>
	  <refentrytitle>unicode::iconvert::tou</refentrytitle>
	  <manvolnum>3</manvolnum>
	</refmeta>

	<refnamediv>
	  <refname>unicode::iconvert::tou</refname>

	  <refpurpose>template for converting text sequence to unicode</refpurpose>
	</refnamediv>

	<refsynopsisdiv>
	  <funcsynopsis>
	    <funcsynopsisinfo>#include &lt;courier-unicode.h&gt;</funcsynopsisinfo>

	    <funcprototype>
              <funcdef>output_iter_t <function>convert</function></funcdef>
              <paramdef>input_iter_t <parameter>beg_iter</parameter></paramdef>
              <paramdef>input_iter_t <parameter>end_iter</parameter></paramdef>
              <paramdef>const std::string &amp;<parameter>charset</parameter></paramdef>
	      <paramdef>bool &amp;<parameter>errflag</parameter></paramdef>
              <paramdef>output_iter_t <parameter>output_iter</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>bool <function>convert</function></funcdef>
              <paramdef>input_iter_t <parameter>beg_iter</parameter></paramdef>
              <paramdef>input_iter_t <parameter>end_iter</parameter></paramdef>
              <paramdef>const std::string &amp;<parameter>charset</parameter></paramdef>
              <paramdef>std::u32string &amp;<parameter>out_buf</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>std::pair&lt;std::u32string, bool&gt; <function>convert</function></funcdef>
              <paramdef>const std::string &amp;<parameter>text</parameter></paramdef>
              <paramdef>const std::string &amp;<parameter>charset</parameter></paramdef>
	    </funcprototype>
	  </funcsynopsis>
	</refsynopsisdiv>

	<refsect1 id="unicode_cpp_convert_tou_descr">
	  <title>DESCRIPTION</title>

	  <para>
	    These template functions convert text in a given character set
	    to unicode characters.
	    <parameter>beg_iter</parameter> and
	    <parameter>end_iter</parameter> define an input sequence of
	    <classname>char</classname>s in the <parameter>charset</parameter>
	    character set. They get converted to unicode characters.
	    <parameter>output_iter</parameter> is an output iterator that
	    <function>convert</function>()
	    iterates over <classname>char32_t</classname>s.
	    <function>convert</function>() returns the value of the output
	    iterator after iterating over the converted character sequence.
	    <parameter>errflag</parameter>, passed by reference, gets set to
	    <literal>true</literal> if some character could not be converted
	    to unicode, from the specified character set, and
	    <literal>false</literal> if the conversion completed without
	    errors.
	  </para>

	  <para>
	    An overloaded <function>convert</function>() puts the unicode
	    character sequence into a vector of
	    <classname>char32_t</classname>s, instead of an output
	    sequence, and returned the error flag.
	    Finally, a single <classname>std::string</classname>
	    specifies the character string, instead of a beginning and an
	    ending iterator, and returns a
	    <classname>std::pair</classname> with the converted unicode
	    text in a vector, and the error flag.
	  </para>
	</refsect1>

	<refsect1 id="unicode_cpp_convert_tou_seealso">
	  <title>SEE ALSO</title>
	  <para>
	    <link linkend="courier-unicode">
	      <citerefentry>
		<refentrytitle>courier-unicode</refentrytitle>
		<manvolnum>7</manvolnum></citerefentry></link>,
	    <link linkend="unicode__iconvert__convert">
	      <citerefentry><refentrytitle>unicode::convert::convert</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	    <link linkend="unicode_convert">
	      <citerefentry><refentrytitle>unicode_convert</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	      <ulink url="https://manpages.courier-mta.org/htmlman3/iconv.3.html">
	      <citerefentry><refentrytitle>iconv</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></ulink>.

	  </para>
	</refsect1>
      </refentry>

      <refentry id="unicode__linebreak">
	<refentryinfo><author><firstname>Sam</firstname><surname>Varshavchik</surname><contrib>Author</contrib></author><productname>Courier Unicode Library</productname></refentryinfo>

	<refmeta>
	  <refentrytitle>unicode::linebreak</refentrytitle>
	  <manvolnum>3</manvolnum>
	</refmeta>

	<refnamediv>
	  <refname>unicode::linebreak_callback_base</refname>
	  <refname>unicode::linebreak_callback_save_buf</refname>
	  <refname>unicode::linebreakc_callback_base</refname>
	  <refname>unicode::linebreak_iter</refname>
	  <refname>unicode::linebreakc_iter</refname>

	  <refpurpose>unicode line-breaking rules</refpurpose>
	</refnamediv>

	<refsynopsisdiv>
	  <programlisting>
#include &lt;courier-unicode.h&gt;

class linebreak : public unicode::linebreak_callback_base {

public:

    using unicode::linebreak_callback_base::operator&lt;&lt;;
    using unicode::linebreak_callback_base::operator();
    int callback(int linebreak_code)
    {
        // ...
    }
};

char32_t c;
std::u32string buf;

linebreak compute_linebreak;

compute_linebreak.set_opts(UNICODE_LB_OPT_SYBREAK);
compute_linebreak &lt;&lt; c;

compute_linebreak(buf);
compute_linebreak(buf.begin(), buf.end());

compute_linebreak.finish();

// ...

unicode::linebreak_callback_save_buf linebreaks;

std::list&lt;int&gt; lb=linebreaks.lb_buf;

class linebreakc : public unicode::linebreakc_callback_base {

public:

    using unicode::linebreak_callback_base::operator&lt;&lt;;
    using unicode::linebreak_callback_base::operator();
    int callback(int linebreak_code, char32_t ch)
    {
        // ...
    }
};

// ...

std::u32string buf;

typedef unicode::linebreak_iter&lt;std::u32string::const_iterator&gt; iter_t;

iter_t beg_iter(buf.begin(), buf.end()), end_iter;

beg_iter.set_opts(UNICODE_LB_OPT_SYBREAK);

std::vector&lt;int&gt; linebreaks;

std::copy(beg_iter, end_iter, std::back_insert_iterator&lt;std::vector&lt;int&gt;&gt;(linebreaks));

// ...

typedef unicode::linebreakc_iter&lt;std::u32string::const_iterator&gt; iter_t;

iter_t beg_iter(buf.begin(), buf.end()), end_iter;

beg_iter.set_opts(UNICODE_LB_OPT_SYBREAK);

std::vector&lt;std::pair&lt;int, char32_t&gt;&gt; linebreaks;

std::copy(beg_iter, end_iter, std::back_insert_iterator&lt;std::vector&lt;int&gt;&gt;(linebreaks));</programlisting>
	</refsynopsisdiv>

	<refsect1 id="unicode_cpp_lb_descr">
	  <title>DESCRIPTION</title>

	  <para>
	    <classname>unicode::linebreak_callback_base</classname> is a C++
	    binding for the unicode line-breaking rule implementation described
	    in
	    <link linkend="unicode_line_break">
	      <citerefentry><refentrytitle>unicode_line_break</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>.
	  </para>

	  <para>
	    Subclass <classname>unicode::linebreak_callback_base</classname>
	    and implement <methodname>callback</methodname>() that's virtually
	    inherited from
	    <classname>unicode::linebreak_callback_base</classname>.
	    The
	    <methodname>callback</methodname>() callback function receives the
	    output values from the line-breaking algorithm, the
	    <literal>UNICODE_LB_MANDATORY</literal>,
	    <literal>UNICODE_LB_NONE</literal>, or the
	    <literal>UNICODE_LB_ALLOWED</literal> value, for each unicode
	    character.
	  </para>

	  <para>
	    <methodname>callback</methodname>() should return 0. A non-zero
	    return reports an error, that stops the line-breaking algorithm.
	    See
	    <link linkend="unicode_line_break">
	      <citerefentry><refentrytitle>unicode_line_break</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link> for more
	      information.
	  </para>

	  <para>
	    The alternate
	    <classname>unicode::linebreakc_callback_base</classname>
	    interface uses a virtually inherited
	    <methodname>callback</methodname>() that receives two parameters,
	    the line-break code value, and the corresponding unicode character.
	  </para>
 	  <para>
	    The input unicode characters for the line-breaking
	    algorithm are provided by the <literal>&lt;&lt;</literal>
	    operator, one unicode character at a time; or by the
	    <literal>()</literal> operator, passing either a container, or
	    a beginning and an ending iterator value for an input sequence
	    of unicode characters. <methodname>finish</methodname>() indicates
	    the end of the unicode character sequence.
	  </para>

	  <para>
	    <methodname>set_opts</methodname> sets line-breaking options
	    (see <methodname>unicode_lb_set_opts</methodname>() for more
	    information).
	  </para>
	  <para>
	    <classname>unicode::linebreak_callback_save_buf</classname> is a
	    subclass that implements <methodname>callback</methodname>() by
	    saving the linebreaks codes into a <classname>std::list</classname>.
	  </para>

	  <para>
	    The <classname>linebreak_iter</classname> template implements an
	    input iterator over <classname>int</classname>s.
	    The template parameter is an input iterator over
	    <classname>unicode</classname> chars. The constructor's parameters
	    are a beginning and an ending iterator value for a sequence of
	    <classname>char32_t</classname>. This constructs the beginning
	    iterator value for a sequence of <classname>int</classname>s
	    consisting of line-break values
	    (<literal>UNICODE_LB_MANDATORY</literal>,
	    <literal>UNICODE_LB_NONE</literal>, or
	    <literal>UNICODE_LB_ALLOWED</literal>) corresponding to each
	    <classname>char32_t</classname> in the underlying sequence.
	    The default constructor creates the ending iterator value for the
	    sequence.
	  </para>

	  <para>
	    The iterator implements a <methodname>set_opts</methodname>()
	    methods that sets the options for the line-breaking algorithm.
	  </para>

	  <para>
	    The <classname>linebreakc_iter</classname> template implements a
	    similar input iterator, with the difference that it ends up iterating
	    over a <classname>std::pair</classname> of line-breaking values and
	    the corresponding <classname>char32_t</classname> from the
	    underlying input sequence.
	  </para>
	</refsect1>

	<refsect1 id="unicode_cpp_lb_seealso">
	  <title>SEE ALSO</title>
	  <para>
	    <link linkend="courier-unicode">
	      <citerefentry>
		<refentrytitle>courier-unicode</refentrytitle>
		<manvolnum>7</manvolnum></citerefentry></link>,
	    <link linkend="unicode_line_break">
	      <citerefentry><refentrytitle>unicode_line_break</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>.
	  </para>
	</refsect1>
      </refentry>

      <refentry id="unicode__tolower">
	<refentryinfo><author><firstname>Sam</firstname><surname>Varshavchik</surname><contrib>Author</contrib></author><productname>Courier Unicode Library</productname></refentryinfo>

	<refmeta>
	  <refentrytitle>unicode::tolower</refentrytitle>
	  <manvolnum>3</manvolnum>
	</refmeta>

	<refnamediv>
	  <refname>unicode::tolower</refname>
	  <refname>unicode::toupper</refname>
	  <refpurpose>unicode version of
	  <citerefentry><refentrytitle>tolower</refentrytitle>
	  <manvolnum>3</manvolnum></citerefentry>
	  and
	  <citerefentry><refentrytitle>toupper</refentrytitle>
	  <manvolnum>3</manvolnum></citerefentry>
	  </refpurpose>
	</refnamediv>

	<refsynopsisdiv>
	  <funcsynopsis>
	    <funcsynopsisinfo>#include &lt;courier-unicode.h&gt;</funcsynopsisinfo>
	    <funcprototype>
              <funcdef>std::string <function>unicode::tolower</function></funcdef>
	      <paramdef>const std::string &amp;<parameter>string</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>std::string <function>unicode::tolower</function></funcdef>
	      <paramdef>const std::string &amp;<parameter>string</parameter></paramdef>
	      <paramdef>const std::string &amp;<parameter>charset</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>std::u32string <function>unicode::tolower</function></funcdef>
	      <paramdef>const std::u32string &amp;<parameter>u</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>std::string <function>unicode::toupper</function></funcdef>
	      <paramdef>const std::string &amp;<parameter>string</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>std::string <function>unicode::toupper</function></funcdef>
	      <paramdef>const std::string &amp;<parameter>string</parameter></paramdef>
	      <paramdef>const std::string &amp;<parameter>charset</parameter></paramdef>
	    </funcprototype>

	    <funcprototype>
              <funcdef>std::u32string <function>unicode::toupper</function></funcdef>
	      <paramdef>const std::u32string &amp;<parameter>u</parameter></paramdef>
	    </funcprototype>
	  </funcsynopsis>
	</refsynopsisdiv>

	<refsect1 id="unicode_cpp_tolower_descr">
	  <title>DESCRIPTION</title>

	  <para>
	    These functions convert the <replaceable>string</replaceable>
	    parameter, in <replaceable>charset</replaceable> or
	    <link linkend="unicode_default_chset">
	      <citerefentry><refentrytitle>unicode_default_chset</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>,
	      to unicode, replace each character with
	      <link linkend="unicode_uc">
		<citerefentry><refentrytitle>unicode_lc</refentrytitle>
		<manvolnum>3</manvolnum></citerefentry></link> or
	      <link linkend="unicode_uc">
		<citerefentry><refentrytitle>unicode_uc</refentrytitle>
		<manvolnum>3</manvolnum></citerefentry></link>,
		then convert it back to the same character set, returning
		the resulting string.
	  </para>

	  <para>
	    Passing a
	    <classname>const std::u32string &amp;</classname>
	    directly also converts it accordingly, returning the converted
	    unicode string.
	  </para>
	</refsect1>

	<refsect1 id="unicode_cpp_tolower_seealso">
	  <title>SEE ALSO</title>
	  <para>
	    <link linkend="courier-unicode">
	      <citerefentry>
		<refentrytitle>courier-unicode</refentrytitle>
		<manvolnum>7</manvolnum></citerefentry></link>.
	  </para>
	</refsect1>
      </refentry>

      <refentry id="unicode__wordbreak">
	<refentryinfo><author><firstname>Sam</firstname><surname>Varshavchik</surname><contrib>Author</contrib></author><productname>Courier Unicode Library</productname></refentryinfo>

	<refmeta>
	  <refentrytitle>unicode::wordbreak</refentrytitle>
	  <manvolnum>3</manvolnum>
	</refmeta>

	<refnamediv>
	  <refname>unicode::wordbreak_callback_base</refname>
	  <refname>unicode::wordbreak</refname>
	  <refpurpose>unicode word-breaking rules</refpurpose>
	</refnamediv>

	<refsynopsisdiv>
	  <programlisting>
#include &lt;courier-unicode.h&gt;

class wordbreak : public unicode::wordbreak_callback_base {

public:

    using unicode::wordbreak_callback_base::operator&lt;&lt;;
    using unicode::wordbreak_callback_base::operator();
    int callback(bool flag)
    {
        // ...
    }
};

char32_t c;
std::u32string buf;

wordbreak compute_wordbreak;

compute_wordbreak &lt;&lt; c;

compute_wordbreak(buf);
compute_wordbreak(buf.begin(), buf.end());

compute_wordbreak.finish();

// ...

unicode_wordbreakscan scan;

scan &lt;&lt; c;

size_t nchars=scan.finish();

</programlisting>
	</refsynopsisdiv>

	<refsect1 id="unicode_cpp_wb_descr">
	  <title>DESCRIPTION</title>

	  <para>
	    <classname>unicode::wordbreak_callback_base</classname> is a C++
	    binding for the unicode word-breaking rule implementation described
	    in
	    <link linkend="unicode_word_break">
	      <citerefentry><refentrytitle>unicode_word_break</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>.
	  </para>

	  <para>
	    Subclass <classname>unicode::wordbreak_callback_base</classname>
	    and implement <methodname>callback</methodname>() that's virtually
	    inherited from
	    <classname>unicode::wordbreak_callback_base</classname>.
	    The
	    <methodname>callback</methodname>() callback function receives the
	    output values from the word-breaking algorithm, namely a
	    <classname>bool</classname> indicating whether a word break
	    exists before the unicode character in the underlying input sequence.
	  </para>

	  <para>
	    <methodname>callback</methodname>() should return 0. A non-zero
	    return reports an error, that stops the word-breaking algorithm.
	    See
	    <link linkend="unicode_word_break">
	      <citerefentry><refentrytitle>unicode_word_break</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link> for more
	      information.
	  </para>

 	  <para>
	    The input unicode characters for the word-breaking
	    algorithm are provided by the <literal>&lt;&lt;</literal>
	    operator, one unicode character at a time; or by the
	    <literal>()</literal> operator, passing either a container, or
	    a beginning and an ending iterator value for an input sequence
	    of unicode characters. <methodname>finish</methodname>() indicates
	    the end of the unicode character sequence.
	  </para>

	  <para>
	    <classname>unicode::wordbreakscan</classname> is a C++
	    binding for the
	    <function>unicode_wbscan_init</function>(),
            <function>unicode_wbscan_next</function>() and
            <function>unicode_wbscan_end</function>
	    methods described in
	    <link linkend="unicode_word_break">
	      <citerefentry><refentrytitle>unicode_word_break</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>.
	      Its <methodname>&lt;&lt;</methodname> iterates over the
	      unicode characters, and <methodname>finish</methodname>()
	      indicates the number of characters before the first unicode
	      word break. The <methodname>&lt;&lt;</methodname> iterator
	      returns a <classname>bool</classname> indicating when the first
	      word break has already been found, so further calls are not
	      necessary.
	  </para>
	</refsect1>

	<refsect1 id="unicode_cpp_wb_seealso">
	  <title>SEE ALSO</title>
	  <para>
	    <link linkend="courier-unicode">
	      <citerefentry>
		<refentrytitle>courier-unicode</refentrytitle>
		<manvolnum>7</manvolnum></citerefentry></link>,
	    <link linkend="unicode_word_break">
	      <citerefentry><refentrytitle>unicode_word_break</refentrytitle>
	      <manvolnum>3</manvolnum></citerefentry></link>.
	  </para>
	</refsect1>
      </refentry>

    </section>
  </section>
  <section id="COPYING">
    <title>COPYING</title>

    <para role="COPYING">
      The Courier Unicode Library is free software, distributed under the
      terms of the GPL, version 3:
    </para>
    <blockquote>
      <literallayout><xi:include href="COPYING" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" /></literallayout>
    </blockquote>
  </section>
</article>