LCOV - code coverage report
Current view: top level - unotools/source/misc - fontcvt.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 87 363 24.0 %
Date: 2015-06-13 12:38:46 Functions: 11 16 68.8 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <sal/config.h>
      21             : 
      22             : #include <sal/log.hxx>
      23             : #include <unotools/fontcvt.hxx>
      24             : #include <unotools/fontdefs.hxx>
      25             : #include <sal/macros.h>
      26             : 
      27             : #include <map>
      28             : #include <vector>
      29             : #include <algorithm>
      30             : #include <functional>
      31             : 
      32             : //These conversion tables were designed for StarSymbol. OpenSymbol
      33             : //originally didn't have the same code points as StarSymbol, and
      34             : //then gained some extra code points, but there are still potentially
      35             : //various holes in OpenSymbol which were filled by StarSymbol, i.e.
      36             : //destination mapping points which are empty in OpenSymbol
      37             : 
      38             : // note: the character mappings that are only approximations
      39             : //       are marked (with an empty comment)
      40             : 
      41             : static const sal_Unicode aStarBatsTab[224] =
      42             : {
      43             :     // F020
      44             :         0x0020,    0x263a,    0x25cf,    0x274d,
      45             :         0x25a0,    0x25a1,    0xE000,    0x2751,
      46             :         0x2752,    0xE001,    0xE002,    0xE003,
      47             :         0x2756,    0xE004,    0xE005,    0x27a2,
      48             :     // F030
      49             :         0xE006,    0x2794,    0x2713,    0x2612,
      50             :         0x2611,    0x27b2,    0x261b,    0x270d,
      51             :         0x270e,    0xE007,    0x2714,    0xE008,
      52             :         0xE009,    0xE00A,    0x274f,    0x2750,
      53             :     // F040
      54             :         0xE00B,    0xE00C,    0xE00D,    0xE00E,
      55             :         0x2722,    0x2723,    0x2724,    0x2725,
      56             :         0x2733,    0x2734,    0x2735,    0x2736,
      57             :         0x2737,    0x2738,    0x2739,    0x2717,
      58             :     // F050
      59             :         0x2718,    0x2719,    0x271a,    0x271b,
      60             :         0x271c,    0x272b,    0x272c,    0x272d,
      61             :         0x272e,    0x272f,    0x2730,         0,
      62             :         0xE00F,    0x278a,    0x278b,    0x278c,
      63             :     // F060
      64             :         0x278d,    0x278e,    0x278f,    0x2790,
      65             :         0x2791,    0x2792,    0x2793,    0xE010,
      66             :         0x2780,    0x2781,    0x2782,    0x2783,
      67             :         0x2784,    0x2785,    0x2786,    0x2787,
      68             :     // F070
      69             :         0x2788,    0x2789,    0xE011,    0xE012,
      70             :         0x260e,    0xE013,    0xE014,    0xE015,
      71             :         0xE016,    0xE017,    0xE018,    0xE019,
      72             :         0xE01A,    0x261e,    0xE01B,         0,
      73             :     // F080
      74             :         0x20ac,         0,    0x201a,    0x0192,
      75             :         0x201e,    0x2026,    0x2020,    0x2021,
      76             :         0xE01c,    0x2030,    0x0160,    0x2039,
      77             :         0x0152,         0,    0x017d,         0,
      78             :     // F090
      79             :              0,    0x2018,    0x2019,    0x201c,
      80             :         0x201d,    0x2022,    0x2013,    0x2014,
      81             :         0xE01d,    0x2122,    0x0161,    0x203a,
      82             :         0x0153,         0,    0x017e,    0x0178,
      83             :     // F0A0
      84             :              0,    0x21e7,    0x21e8,    0x21e9,
      85             :         0x21e6,    0xE01e,    0xE01f,    0x00a7,
      86             :         0xE020,    0xE021,    0xE022,    0x00ab,
      87             :         0xE023,    0x2639,    0xE024,    0xE025,
      88             :     // F0B0
      89             :         0xE026,    0xE027,    0xE028,    0x21e5,
      90             :         0x21e4,    0x2192,    0x2193,    0x2190,
      91             :         0x2191,    0xE029,    0xE02a,    0x00bb,
      92             :         0xE02b,    0xE02c,    0xE02d,    0xE02e,
      93             :     // F0C0
      94             :         0xE02f,    0xE030,    0xE031,    0xE032,
      95             :         0x25be,    0x25b4,    0x25bf,    0x25b5,
      96             :         0xE033,    0xE034,    0xE035,    0x2702,
      97             :         0x2708,    0x2721,    0x273f,    0x2744,
      98             :     // F0D0
      99             :         0x25d7,    0x2759,    0xE036,    0xE037,
     100             :         0x2762,    0x2663,    0x2665,    0x2660,
     101             :         0x2194,    0x2195,    0x2798,    0x279a,
     102             :         0x27b8,         0,    0x00b6,         0,
     103             :     // F0E0
     104             :         0x00a2,    0x00a4,    0x00a5,    0xE038,
     105             :         0x20a1,    0x20a2,    0x20a3,    0x20a4,
     106             :         0x20a9,    0x20ab,    0x20a8,    0xE039,
     107             :              0,         0,         0,         0,
     108             :     // F0F0
     109             :              0,         0,         0,         0,
     110             :              0,         0,         0,         0,
     111             :              0,         0,         0,         0,
     112             :              0,         0,         0,    0xE03a
     113             : };
     114             : 
     115             : static const sal_Unicode aStarMathTab[224] =
     116             : {
     117             :     // F020
     118             :         0x0020,    0x0021,    0x0022,    0x0023,
     119             :         0xE080,    0x0025,    0x0026,    0x221e,
     120             :         0x0028,    0x0029,    0x002a,    0x002b,
     121             :         0x002c,    0x002d,    0x002e,    0x002f,
     122             :     // F030
     123             :         0x2224,    0x21d2,    0x21d0,    0x21d4,
     124             :         0xE081,    0xE082,    0x00b0,         0,
     125             :              0,         0,    0x003a,    0x003b,
     126             :         0x003c,    0x003d,    0x003e,    0x00bf,
     127             :     // F040
     128             :         0x2260,    0xE083,    0x2212,    0x2217,
     129             :         0x00d7,    0x22c5,    0x00f7,    0x00b1,
     130             :         0x2213,    0x2295,    0x2296,    0x2297,
     131             :         0x2298,    0x2299,    0x222a,    0x2229,
     132             :     // F050
     133             :         0xE084,    0xE085,    0x2264,    0x2265,
     134             :         0xE086,    0xE087,    0x226a,    0x226b,
     135             :         0x007e,    0x2243,    0x2248,    0x225d,
     136             :         0x2261,    0x221d,    0x2202,    0x2282,
     137             :     // F060
     138             :         0x2283,    0x2286,    0x2287,    0x2284,
     139             :         0x2285,    0x2288,    0x2289,    0x2208,
     140             :         0x2209,    0xE089,    0x2203,    0x220d,
     141             :         0x2135,    0x2111,    0x211c,    0x2118,
     142             :     // F070
     143             :         0xE08a,    0x2221,    0x2222,    0x2223,
     144             :         0x2225,    0x22a5,    0xE08b,    0x22ef,
     145             :         0x22ee,    0x22f0,    0x22f1,    0x22b6,
     146             :         0x22b7,    0xE08c,    0x2216,    0x00ac,
     147             :     // F080
     148             :         0x222b,    0x222c,    0x222d,    0x222e,
     149             :         0x222f,    0x2230,    0x221a,    0xE08d,
     150             :         0xE08e,    0xE08f,    0x2210,    0x220f,
     151             :         0x2211,    0x2207,    0x2200,    0xE090,
     152             :     // F090
     153             :         0xE091,    0xE092,    0xE093,    0xE094,
     154             :         0xE095,    0xE096,    0xE097,    0xE098,
     155             :         0x02d9,    0x00a8,    0xE09b,    0x02da,
     156             :         0x2227,    0x2228,    0x220b,    0x2205,
     157             :     // F0A0
     158             :         0x007b,    0x007d,    0xe09e,    0xe09f,
     159             :         0x2329,    0x232a,    0x005b,    0x005d,
     160             :         0xE0a0,    0x22be,    0xE0a1,    0x2259,
     161             :         0x2254,    0x2255,    0x21b3,    0x2197,
     162             :     // F0B0
     163             :         0x2198,    0x2245,    0x301a,    0x301b,
     164             :         0x2373,    0xE0a5,    0xE0a6,    0x22a4,
     165             :         0x2112,    0x2130,    0x2131,         0,
     166             :         0xE0a7,    0xE0a8,    0xE0a9,    0xE0aa,
     167             :     // F0C0
     168             :         0x2308,    0x230a,    0x2309,    0x230b,
     169             :              0,    0xe0ab,    0xe0ac,    0xe0ad,
     170             :         0xe0ae,    0xe0af,    0xe0b0,    0xe0b1,
     171             :         0xe0b2,    0xe0b3,    0xe0b4,    0xe0b5,
     172             :     // F0D0
     173             :         0xe0b6,    0xe0b7,    0xe0b8,    0xe0b9,
     174             :         0xe0ba,    0xe0bb,    0xe0bc,    0xe0bd,
     175             :         0xe0be,    0xe0bf,    0xe0c0,    0xe0c1,
     176             :         0xe0c2,    0xe0c3,    0xe0c4,    0xe0c5,
     177             :     // F0E0
     178             :         0xe0c6,    0xe0c7,    0xe0c8,    0xe0c9,
     179             :         0xe0ca,    0xe0cb,    0xe0cc,    0xe0cd,
     180             :         0xe0ce,    0xe0cf,    0xe0d0,    0xe0d1,
     181             :         0x03f1,    0xe0d3,    0xe0d4,    0xe0d5,
     182             :     // F0F0
     183             :         0x2113,     0xe0d6,   0x2107,    0x2127,
     184             :         0x210a,     0xe0d9,   0x210f,    0x019b,
     185             :         0xe0db,     0xe0dc,   0xe0dd,    0x2115,
     186             :         0x2124,     0x211a,   0x211d,    0x2102
     187             : };
     188             : 
     189             : static const sal_Unicode aWingDingsTab[224] =
     190             : {
     191             :     // F020
     192             :         0x0020,    0xe400,    0xe401,    0xe402,
     193             :         0xe403,    0xe404,    0xe405,    0xe406,
     194             :         0xe407,    0xe408,    0xe409,    0xe40a,
     195             :         0xe40b,    0xe40c,    0xe40d,    0xe40e,
     196             :     // F030
     197             :         0xe40f,    0xe410,    0xe411,    0xe412,
     198             :         0xe413,    0xe414,    0xe415,    0xe416,
     199             :         0xe417,    0xe418,    0xe419,    0xe41a,
     200             :         0xe41b,    0xe41c,    0x2707,    0xe41d,
     201             :     // F040
     202             :         0xe41e,    0xe41f,    0xe420,    0xe421,
     203             :         0x261c,    0xe423,    0x261d,    0x261f,
     204             :         0x261f,    0xe424,    0xe425,    0xe426,
     205             :         0xe427,    0xe428,    0xe429,    0xe42a,
     206             :     // F050
     207             :         0xe42b,    0xe42c,    0x263c,    0xe42d,
     208             :         0xe42e,    0xe42f,    0xe430,    0xe431,
     209             :         0xe432,    0xe433,    0x262a,    0x262f,
     210             :         0x0950,    0xe434,    0x2648,    0x2649,
     211             :     // F060
     212             :         0x264a,    0x264b,    0x264c,    0x264d,
     213             :         0x264e,    0x264f,    0x2650,    0x2651,
     214             :         0x2652,    0x2653,    0xe435,    0xe436,
     215             :         0xe437,    0xe438,    0xe439,    0xe43a,
     216             :     // F070
     217             :         0xe43b,    0xe43c,    0xe43d,    0xe43e,
     218             :         0xe43f,    0xe440,    0xe441,    0xe442,
     219             :         0xe443,    0x2353,    0x2318,    0xe444,
     220             :         0xe445,    0xe446,    0xe447,         0,
     221             :     // F080
     222             :         0xe448,    0xe449,    0xe44a,    0xe44b,
     223             :         0xe44c,    0xe44d,    0xe44e,    0xe44f,
     224             :         0xe450,    0xe451,    0xe452,    0xe453,
     225             :         0xe454,    0xe455,    0xe456,    0xe457,
     226             :     // F090
     227             :         0xe458,    0xe459,    0xe45a,    0xe45b,
     228             :         0xe45c,    0xe45d,    0xe45e,    0xe45f,
     229             :         0xe460,    0xe461,    0xe462,    0xe463,
     230             :         0xe464,    0xe465,    0xe466,    0xe467,
     231             :     // F0a0
     232             :         0xe468,    0xe469,    0xe46a,    0xe46b,
     233             :         0xe46c,    0xe46d,    0xe46e,    0xe46f,
     234             :         0xe470,    0xe471,    0xe472,    0xe473,
     235             :         0xe474,    0xe475,    0xe476,    0xe477,
     236             :     // F0b0
     237             :         0xe478,    0xe479,    0xe47a,    0xe47b,
     238             :         0xe47c,    0xe47d,    0xe47e,    0xe47f,
     239             :         0xe480,    0xe481,    0xe482,    0xe483,
     240             :         0xe484,    0xe485,    0xe486,    0xe487,
     241             :     // F0c0
     242             :         0xe488,    0xe489,    0xe48a,    0xe48b,
     243             :         0xe48c,    0xe48d,    0xe48e,    0xe48f,
     244             :         0xe490,    0xe491,    0xe492,    0xe493,
     245             :         0xe494,    0xe495,    0xe496,    0xe497,
     246             :     // F0d0
     247             :         0xe498,    0xe499,    0xe49a,    0xe49b,
     248             :         0xe49c,    0x232b,    0x2326,    0xe49d,
     249             :         0xe49e,    0xe49f,    0xe4a0,    0xe4a1,
     250             :         0xe4a2,    0xe4a3,    0xe4a4,    0xe4a5,
     251             :     // F0e0
     252             :         0xe4a6,    0xe4a7,    0xe4a8,    0xe4a9,
     253             :         0xe4aa,    0xe4ab,    0xe4ac,    0xe4ad,
     254             :         0xe4ae,    0xe4af,    0xe4b0,    0xe4b1,
     255             :         0xe4b2,    0xe4b3,    0xe4b4,    0xe4b5,
     256             :     // F0f0
     257             :         0xe4b6,    0xe4b7,    0xe4b8,    0xe4b9,
     258             :         0xe4ba,    0xe4bb,    0xe4bc,    0xe4bd,
     259             :         0xe4be,    0xe4bf,    0xe4c0,    0xe4c1,
     260             :         0xe4c2,    0xe4c3,    0xe4c4,    0xe4c5
     261             : };
     262             : 
     263             : static const sal_Unicode aWingDings2Tab[224] =
     264             : {
     265             :     // F020
     266             :         0x0020,    0xe500,    0xe501,    0xe502,
     267             :         0xe503,    0xe504,    0xe505,    0xe506,
     268             :         0xe507,    0xe508,    0xe509,    0xe50a,
     269             :         0xe50b,    0xe50c,    0xe50d,    0xe50e,
     270             :     // F030
     271             :         0xe50f,    0xe510,    0xe511,    0xe512,
     272             :         0xe513,    0xe514,    0xe515,    0xe516,
     273             :         0xe517,    0xe518,    0xe519,    0xe51a,
     274             :         0xe51b,    0xe51c,    0xe51d,    0xe51e,
     275             :     // F040
     276             :         0xe51f,    0xe520,    0xe521,    0xe522,
     277             :         0xe523,    0xe524,    0xe525,    0xe526,
     278             :         0xe527,    0xe528,    0xe529,    0xe52a,
     279             :         0xe52b,    0xe52c,    0xe52d,    0xe52e,
     280             :     // F050
     281             :         0xe52f,    0xe530,    0xe531,    0xe532,
     282             :         0xe533,    0xe534,    0xe535,    0xe536,
     283             :         0xe537,    0x203D,    0x203D,    0x203D,
     284             :         0xe53b,    0xe53c,    0xe53d,    0xe53e,
     285             :     // F060
     286             :         0xe53f,    0xe540,    0xe541,    0xe542,
     287             :         0xe543,    0xe544,    0xe545,    0xe546,
     288             :         0xe547,    0x24EA,    0x2460,    0x2461,
     289             :         0x2462,    0x2463,    0x2464,    0x2465,
     290             :     // F070
     291             :         0x2466,    0x2467,    0x2468,    0x2469,
     292             :         0xE453,    0x278A,    0x278B,    0x278C,
     293             :         0x278D,    0x278E,    0x278F,    0x2790,
     294             :         0x2791,    0x2792,    0x2793,         0,
     295             :     // F080
     296             :         0x2609,    0x25cb,    0x263d,    0x263e,
     297             :         0xe55d,    0xe55e,    0xe55f,    0xe560,
     298             :         0xe561,    0xe562,    0xe563,    0xe564,
     299             :         0xe565,    0xe566,    0xe567,    0xe568,
     300             :     // F090
     301             :         0xe569,    0xe56a,    0xe56b,    0xe56c,
     302             :         0xe56d,    0xe56e,    0xe56f,    0xe570,
     303             :         0xe571,    0xe572,    0xe573,    0xe574,
     304             :         0xe575,         0,         0,    0xe578,
     305             :     // F0a0
     306             :         0xe579,    0xe57a,    0xe57b,    0xe57c,
     307             :              0,         0,         0,         0,
     308             :              0,         0,         0,    0xe584,
     309             :         0xe585,         0,    0xe586,         0,
     310             :     // F0b0
     311             :              0,         0,         0,         0,
     312             :         0xe58d,    0xe58e,    0xe58f,    0xe590,
     313             :              0,         0,    0xe593,    0xe594,
     314             :              0,         0,         0,    0xe587,
     315             :     // F0c0
     316             :         0xe599,    0xe59a,    0xe59b,    0xe59c,
     317             :         0xe59d,    0xe59e,    0xe59f,    0xe5a0,
     318             :         0xe5a1,    0xe5a2,    0xe5a3,    0xe5a4,
     319             :         0xe5a5,    0xe5a6,    0xe5a7,    0xe5a8,
     320             :     // F0d0
     321             :         0xe5a9,    0xe5aa,    0xe5ab,    0xe5ac,
     322             :         0xe5ad,    0xe5ae,    0xe5af,    0xe5b0,
     323             :         0xe5b1,    0xe5b2,    0xe5b3,    0xe5b4,
     324             :         0xe5b5,    0xe5b6,    0xe5b7,    0xe5b8,
     325             :     // F0e0
     326             :         0xe5b9,    0xe5ba,    0xe5bb,    0xe5bc,
     327             :         0xe5bd,    0xe5be,    0xe5bf,    0xe5c0,
     328             :         0xe5c1,    0xe5c2,    0xe5c3,    0xe5c4,
     329             :         0xe5c5,    0xe5c6,    0xe5c7,    0xe5c8,
     330             :     // F0f0
     331             :         0xe5c9,    0,         0xe5cb,    0xe477,
     332             :         0xe5cd,    0xe5ce,    0xe5cf,    0xe5d0,
     333             :         0x203b,    0x2042,         0,         0,
     334             :              0,         0,         0,         0
     335             : };
     336             : 
     337             : static const sal_Unicode aWingDings3Tab[224] =
     338             : {
     339             :     // F020
     340             :         0x0020,    0xe600,    0xe601,    0xe602,
     341             :         0xe603,    0x2196,    0xe604,    0x2199,
     342             :         0xe605,    0xe606,    0xe607,    0xe608,
     343             :         0xe609,    0xe60a,    0xe60b,    0x21de,
     344             :     // F030
     345             :         0x21df,    0xe60c,    0xe60d,    0xe60e,
     346             :         0x21e2,    0x21e1,    0x21e3,    0x21af,
     347             :         0x21b5,    0xe60f,    0xe610,    0xe611,
     348             :         0xe612,    0xe613,    0xe614,    0xe615,
     349             :     // F040
     350             :         0xe616,    0xe617,    0xe618,    0xe619,
     351             :         0x21c4,    0x21c5,    0xe61a,    0xe61b,
     352             :         0x21c7,    0x21c9,    0x21c8,    0x21ca,
     353             :         0x21b6,    0x21b7,    0xe61c,    0xe61d,
     354             :     // F050
     355             :         0x21bb,    0x21ba,    0xe61e,    0x2324,
     356             :         0x2303,    0x2325,    0x2334,    0xe61f,
     357             :         0x21ea,    0xe620,    0xe621,    0xe622,
     358             :         0xe623,    0xe624,    0xe625,    0xe626,
     359             :     // F060
     360             :         0xe627,    0xe628,    0xe629,    0xe62a,
     361             :         0xe62b,    0xe62c,    0xe62d,    0xe62e,
     362             :         0xe62f,    0xe630,    0xe631,    0xe632,
     363             :         0xe633,    0xe634,    0xe635,    0xe636,
     364             :     // F070
     365             :         0xe637,    0xe638,    0x25b3,    0x25bd,
     366             :         0x25c0,    0x25b6,    0x25c1,    0x25b7,
     367             :         0x25e3,    0xe639,    0x25e4,    0x25e5,
     368             :         0x25c2,    0x25b8,    0xe63a,         0,
     369             :     // F080
     370             :         0xe63b,    0xe63c,    0xe63d,    0xe63e,
     371             :         0xe63f,    0xe640,    0xe641,    0xe642,
     372             :         0xe643,    0xe644,    0xe645,    0xe646,
     373             :         0xe647,    0xe648,    0xe649,    0xe64a,
     374             :     // F090
     375             :         0xe64b,    0xe64c,    0xe64d,    0xe64e,
     376             :         0xe64f,    0xe650,    0xe651,    0xe652,
     377             :         0xe653,    0xe654,    0xe655,    0xe656,
     378             :         0xe657,    0xe658,    0xe659,    0xe65a,
     379             :     // F0a0
     380             :         0xe65b,    0xe65c,    0xe65d,    0xe65e,
     381             :         0xe65f,    0xe660,    0xe661,    0xe662,
     382             :         0xe663,    0xe664,    0xe665,    0xe666,
     383             :         0xe667,    0xe668,    0xe669,    0xe66a,
     384             :     // F0b0
     385             :         0xe66b,    0xe66c,    0xe66d,    0xe66e,
     386             :         0xe66f,    0xe670,    0xe671,    0xe672,
     387             :         0xe673,    0xe674,    0xe675,    0xe676,
     388             :         0xe677,    0xe678,    0xe679,    0xe67a,
     389             :     // F0c0
     390             :         0xe67b,    0xe67c,    0xe67d,    0xe67e,
     391             :         0xe67f,    0xe680,    0xe681,    0xe682,
     392             :         0xe683,    0xe684,    0xe685,    0xe686,
     393             :         0xe687,    0xe688,    0xe689,    0xe68a,
     394             :     // F0d0
     395             :         0xe68b,    0xe68c,    0xe68d,    0xe68e,
     396             :         0xe68f,    0xe690,    0xe691,    0xe692,
     397             :         0xe693,    0xe694,    0xe695,    0xe696,
     398             :         0xe697,    0xe698,    0xe699,    0xe69a,
     399             :     // F0e0
     400             :         0xe69b,    0xe69c,    0xe69d,    0xe69e,
     401             :         0xe69f,    0xe6a0,    0xe6a1,    0xe6a2,
     402             :         0xe6a3,    0xe6a4,    0xe6a5,    0xe6a6,
     403             :         0xe6a7,    0xe6a8,    0xe6a9,    0xe6aa,
     404             :     // F0f0
     405             :         0xe6ab,         0,         0,         0,
     406             :              0,         0,         0,         0,
     407             :              0,         0,         0,         0,
     408             :              0,         0,         0,         0
     409             : };
     410             : 
     411             : static const sal_Unicode aWebDingsTab[224] =
     412             : {
     413             :     // F020
     414             :         0x0020,    0xe300,    0xe301,    0xe302,
     415             :         0xe303,    0xe304,    0xe305,    0xe306,
     416             :         0xe307,    0xe308,    0xe309,    0xe30a,
     417             :         0xe30b,    0xe30c,    0xe30d,    0xe30e,
     418             :     // F030
     419             :         0xe30f,    0xe310,    0xe311,    0xe312,
     420             :         0xe313,    0xe314,    0xe315,    0xe316,
     421             :         0xe317,    0xe318,    0xe319,    0xe31a,
     422             :         0xe31b,    0xe31c,    0xe31d,    0xe31e,
     423             :     // F040
     424             :         0xe31f,    0xe320,    0xe321,    0xe322,
     425             :         0xe323,    0xe324,    0xe325,    0xe326,
     426             :         0xe327,    0xe328,    0xe329,    0xe32a,
     427             :         0xe32b,    0xe32c,    0xe32d,    0xe32e,
     428             :     // F050
     429             :         0xe32f,    0xe330,    0xe331,    0xe332,
     430             :         0xe333,    0xe334,    0xe335,    0xe336,
     431             :         0xe337,    0xe338,    0xe339,    0xe33a,
     432             :         0xe33b,    0xe33c,    0xe33d,    0xe33e,
     433             :     // F060
     434             :         0xe33f,    0xe340,    0xe341,    0xe342,
     435             :         0xe343,    0xe344,    0xe345,    0xe346,
     436             :         0xe347,    0xe348,    0xe349,    0xe34a,
     437             :         0xe34b,    0xe34c,    0xe34d,    0xe34e,
     438             :     // F070
     439             :         0xe34f,    0xe350,    0xe351,    0xe352,
     440             :         0xe353,    0xe354,    0xe355,    0xe356,
     441             :         0xe357,    0xe358,    0xe359,    0xe35a,
     442             :         0xe35b,    0xe35c,    0xe35d,         0,
     443             :     // F080
     444             :         0xe35e,    0xe35f,    0xe360,    0xe361,
     445             :         0xe362,    0xe363,    0xe364,    0xe365,
     446             :         0xe366,    0xe367,    0xe368,    0xe369,
     447             :         0xe36a,    0xe36b,    0xe36c,    0xe36d,
     448             :     // F090
     449             :         0xe36e,    0xe36f,    0xe370,    0xe371,
     450             :         0xe372,    0xe373,    0xe374,    0xe375,
     451             :         0xe376,    0xe377,    0xe378,    0xe379,
     452             :         0xe37a,    0xe37b,    0xe37c,    0xe37d,
     453             :     // F0a0
     454             :         0xe37e,    0xe37f,    0xe380,    0xe381,
     455             :         0xe382,    0xe383,    0xe384,    0xe385,
     456             :         0xe386,    0xe387,    0xe388,    0xe389,
     457             :         0xe38a,    0xe38b,    0xe38c,    0xe38d,
     458             :     // F0b0
     459             :         0xe38e,    0xe38f,    0xe390,    0xe391,
     460             :         0xe392,    0xe393,    0xe394,    0xe395,
     461             :         0xe396,    0xe397,    0xe398,    0xe399,
     462             :         0xe39a,    0xe39b,    0xe39c,    0xe39d,
     463             :     // F0c0
     464             :         0xe39e,    0xe39f,    0xe3a0,    0xe3a1,
     465             :         0xe3a2,    0xe3a3,    0xe3a4,    0xe3a5,
     466             :         0xe3a6,    0xe3a7,    0xe3a8,    0xe3a9,
     467             :         0xe3aa,    0xe3ab,    0xe3ac,    0xe3ad,
     468             :     // F0d0
     469             :         0xe3ae,    0xe3af,    0xe3b0,    0xe3b1,
     470             :         0xe3b2,    0xe3b3,    0xe3b4,    0xe3b5,
     471             :         0xe3b6,    0xe3b7,    0xe3b8,    0xe3b9,
     472             :         0xe3ba,    0xe3bb,    0xe3bc,    0xe3bd,
     473             :     // F0e0
     474             :         0xe3be,    0xe3bf,    0xe3c0,    0xe3c1,
     475             :         0xe3c2,    0xe3c3,    0xe3c4,    0xe3c5,
     476             :         0xe3c6,    0xe3c7,    0xe3c8,    0xe3c9,
     477             :         0xe3ca,    0xe3cb,    0xe3cd,    0xe3ce,
     478             :     // F0f0
     479             :         0xe3cf,    0xe3d0,    0xe3d1,    0xe3d2,
     480             :         0xe3d3,    0xe3d4,    0xe3d5,    0xe3d6,
     481             :         0xe3d7,    0xe3d8,    0xe3d9,    0xe3da,
     482             :         0xe3db,    0xe3dc,    0xe3dd,    0xe3de
     483             : };
     484             : 
     485             : static const sal_Unicode aAdobeSymbolTab[224] =
     486             : {
     487             : //TODO:
     488             :     // F020
     489             :         0x0020,    0xe100,    0xe101,    0xe102,
     490             :         0xe103,    0xe104,    0xe16a,    0xe105,
     491             :         0xe106,    0xe107,    0xe108,    0xe109,
     492             :         0xe10a,    0xe10b,    0xe10c,    0xe10d,
     493             :     // F030
     494             :         0x0030,    0x0031,    0x0032,    0x0033,
     495             :         0x0034,    0x0035,    0x0036,    0x0037,
     496             :         0x0038,    0x0039,    0xe10e,    0xe10f,
     497             :         0xe110,    0xe111,    0xe112,    0x003f,
     498             :     // F040
     499             :         0xe113,    0x0391,    0x0392,    0x03a7,
     500             :         0x0394,    0x0395,    0x03a6,    0x0393,
     501             :         0x0397,    0x0399,    0x03d1,    0x039a,
     502             :         0x039b,    0x039c,    0x039d,    0x039f,
     503             :     // F050
     504             :         0x03a0,    0x0398,    0x03a1,    0x03a3,
     505             :         0x03a4,    0x03a5,    0x03c2,    0x03a9,
     506             :         0x039e,    0x03a8,    0x0396,    0xe114,
     507             :         0x2234,    0xe115,    0xe116,    0x005f,
     508             :     // F060
     509             :         0x00af,    0x03b1,    0x03b2,    0x03c7,
     510             :         0x03b4,    0x03b5,    0x03d5,    0x03b3,
     511             :         0x03b7,    0x03b9,    0x03c6,    0x03ba,
     512             :         0x03bb,    0x03bc,    0x03bd,    0x03bf,
     513             :     // F070
     514             :         0x03c0,    0x03b8,    0x03c1,    0x03c3,
     515             :         0x03c4,    0x03c5,    0x03d6,    0x03c9,
     516             :         0x03be,    0x03c8,    0x03b6,    0xe117,
     517             :         0x007c,    0xe118,    0xe119,         0,
     518             :     // F080
     519             :              0,         0,         0,         0,
     520             :              0,         0,         0,         0,
     521             :              0,         0,         0,         0,
     522             :              0,         0,         0,         0,
     523             :     // F090
     524             :              0,         0,         0,         0,
     525             :              0,         0,         0,         0,
     526             :              0,         0,         0,         0,
     527             :              0,         0,         0,         0,
     528             :     // F0a0
     529             :         0xe11a,    0x03d2,    0x0384,    0xe11b,
     530             :         0x2215,    0xe11c,    0xe11d,    0xe11e,
     531             :         0x2666,    0xe11f,    0xe120,    0xe121,
     532             :         0xe122,    0xe123,    0xe124,    0xe125,
     533             :     // F0b0
     534             :         0xe126,    0xe127,    0x2033,    0xe128,
     535             :         0xe129,    0xe12a,    0xe12b,    0xe12c,
     536             :         0xe12d,    0xe12e,    0xe12f,    0xe130,
     537             :         0xe131,    0x2502,    0x2500,    0x21b2,
     538             :     // F0c0
     539             :         0xe132,    0xe133,    0xe134,    0xe135,
     540             :         0xe136,    0xe137,    0xe138,    0xe139,
     541             :         0xe13a,    0xe13b,    0xe13c,    0xe13d,
     542             :         0xe13e,    0xe13f,    0xe140,    0xe141,
     543             :     // F0d0
     544             :         0x2220,    0xe142,    0x00ae,    0x00a9,
     545             :         0xe143,    0xe144,    0xe145,    0xe146,
     546             :         0xe147,    0xe148,    0xe149,    0xe14a,
     547             :         0xe14b,    0x21d1,    0xe14c,    0x21d3,
     548             :     // F0e0
     549             :         0x25ca,    0xe14d,    0xe14e,    0xe14f,
     550             :         0xe150,    0xe151,    0xe152,    0xe153,
     551             :         0xe154,    0xe155,    0xe156,    0xe157,
     552             :         0xe158,    0xe159,    0xe15a,    0xe15b,
     553             :     // F0f0
     554             :              0,    0xe15c,    0xe15d,    0xe15e,
     555             :         0xe15f,    0xe160,    0xe161,    0xe162,
     556             :         0xe163,    0xe164,    0xe165,    0xe166,
     557             :         0xe167,    0xe168,    0xe169,         0,
     558             : };
     559             : 
     560             : static const sal_Unicode aMonotypeSortsTab[224] =
     561             : {
     562             :     // F020
     563             :         0x0020,    0x2701,    0xe200,    0x2703,
     564             :         0x2704,    0xe201,    0x2706,    0xe202,
     565             :         0xe203,    0xe203,    0xe204,    0xe205,
     566             :         0x270c,    0xe206,    0xe207,    0xe208,
     567             :     // F030
     568             :         0x2710,    0x2711,    0x2712,    0xe209,
     569             :         0xe20a,    0x2715,    0x2716,    0xe20b,
     570             :         0xe20c,    0xe20d,    0xe20e,    0xe20f,
     571             :         0xe210,    0x271d,    0x271e,    0x271f,
     572             :     // F040
     573             :         0x2720,    0xe211,    0xe212,    0xe213,
     574             :         0xe214,    0xe215,    0x2726,    0x2727,
     575             :         0x2605,    0x2729,    0x272a,    0xe216,
     576             :         0xe217,    0xe218,    0xe219,    0xe21a,
     577             :     // F050
     578             :         0xe21b,    0xe21c,    0x2732,    0xe21d,
     579             :         0xe21e,    0xe21f,    0xe220,    0xe221,
     580             :         0xe222,    0xe223,    0x273a,    0x273b,
     581             :         0x273c,    0x273d,    0x273e,    0xe224,
     582             :     // F060
     583             :         0x2740,    0x2741,    0x2742,    0x2743,
     584             :         0xe225,    0x2745,    0x2746,    0x2747,
     585             :         0x2748,    0x2749,    0x274a,    0x274b,
     586             :         0xe226,    0xe227,    0xe228,    0xe229,
     587             :     // F070
     588             :         0xe22a,    0xe22b,    0xe22c,    0x25b2,
     589             :         0x25bc,    0xe22d,    0xe22e,    0xe22f,
     590             :         0x2758,    0xe230,    0x275a,    0x275b,
     591             :         0x275c,    0x275d,    0x275e,         0,
     592             :     // F080
     593             :         0xe231,    0xe232,    0xe233,    0xe234,
     594             :         0xe235,    0xe236,    0xe237,    0xe238,
     595             :         0xe239,    0xe23a,    0xe23b,    0xe23c,
     596             :         0xe23d,    0xe23e,         0,         0,
     597             :     // F090
     598             :              0,         0,         0,         0,
     599             :              0,         0,         0,         0,
     600             :              0,         0,         0,         0,
     601             :              0,         0,         0,         0,
     602             :     // F0a0
     603             :              0,    0xe23f,    0xe240,    0x2763,
     604             :         0x2764,    0x2765,    0x2766,    0x2767,
     605             :         0xe241,    0xe242,    0xe243,    0xe244,
     606             :         0x2460,    0x2461,    0x2462,    0x2463,
     607             :     // F0b0
     608             :         0x2464,    0x2465,    0x2466,    0x2467,
     609             :         0x2468,    0x2469,    0x2776,    0x2777,
     610             :         0x2778,    0x2779,    0x277a,    0x277b,
     611             :         0x277c,    0x277d,    0x277e,    0x277f,
     612             :     // F0c0
     613             :         0xe245,    0xe246,    0xe247,    0xe248,
     614             :         0xe249,    0xe24a,    0xe24b,    0xe24c,
     615             :         0xe24d,    0xe24e,    0xe24f,    0xe250,
     616             :         0xe251,    0xe252,    0xe253,    0xe254,
     617             :     // F0d0
     618             :         0xe255,    0xe256,    0xe257,    0xe258,
     619             :         0xe259,    0xe25a,    0xe25b,    0xe25c,
     620             :         0xe25d,    0x2799,    0xe25e,    0x279b,
     621             :         0x279c,    0x279d,    0x279e,    0x279f,
     622             :     // F0e0
     623             :         0x27a0,    0x27a1,    0xe25f,    0x27a3,
     624             :         0x27a4,    0x27a5,    0x27a6,    0x27a7,
     625             :         0x27a8,    0x27a9,    0x27aa,    0x27ab,
     626             :         0x27ac,    0x27ad,    0x27ae,    0x27af,
     627             :     // F0f0
     628             :              0,    0x27b1,    0xe260,    0x27b3,
     629             :         0x27b4,    0x27b5,    0x27b6,    0x27b7,
     630             :         0xe261,    0x27b9,    0x27ba,    0x27bb,
     631             :         0x27bc,    0x27bd,    0x27be,         0,
     632             : };
     633             : 
     634             : static const sal_Unicode aMTExtraTab[224] =
     635             : {
     636             :     // F020
     637             :         0x0020,         0,         0,    0x0300,
     638             :         0x0302,    0x0303,    0x0307,         0,
     639             :         0x2323,    0x2322,         0,         0,
     640             :              0,         0,         0,         0,
     641             :     // F030
     642             :              0,    0xEC00,    0xEC01,    0xEC02,
     643             :         0xEC03,    0xEC0B,    0xEC04,    0xEC05,
     644             :         0xEC06,         0,    0x223C,    0x2243,
     645             :         0x22B2,    0x226A,    0x22B3,    0x226B,
     646             :     // F040
     647             :         0x225C,    0x2259,    0x2250,    0x2210,
     648             :         0x019B,    0xEC0E,    0xEC0F,    0xEC10,
     649             :         0xEC11,    0x2229,    0x2127,    0x2026,
     650             :         0x22EF,    0x22EE,    0x22F0,    0x22F1,
     651             :     // F050
     652             :         0x2225,    0x2235,    0x2221,    0x2222,
     653             :              0,    0x222A,    0x25B3,    0x25A1,
     654             :         0x25AD,    0x25B1,    0x2197,    0x2199,
     655             :         0xEB05,    0x2198,    0x2196,    0xEB06,
     656             :     // F060
     657             :         0x2035,    0x21A6,    0x2195,    0x21D5,
     658             :         0x25CB,    0x2299,    0x227B,    0xE98F,
     659             :         0x210F,    0xEE00,    0xEE01,         0,
     660             :         0x2113,    0x2213,    0xFFFD,    0x2218,
     661             :     // F070
     662             :         0x227A,    0xEB1A,    0x20D7,    0x20D6,
     663             :         0x20E1,    0xEB00,    0x20D1,    0x20D0,
     664             :         0xEB19,         0,         0,    0xFE38,
     665             :         0xEC0C,    0xFE37,    0xEC0D,         0,
     666             :     // F080
     667             :         0x21C4,    0xEB01,    0xEB02,    0x21CC,
     668             :         0xEB03,    0xEB04,    0x21C0,    0x21BD,
     669             :         0xF8E7,         0,         0,         0,
     670             :              0,         0,         0,         0,
     671             :     // F090
     672             :              0,         0,         0,         0,
     673             :              0,         0,         0,         0,
     674             :              0,         0,         0,         0,
     675             :              0,         0,         0,         0,
     676             :     // F0a0
     677             :              0,    0x211D,    0x2124,    0x2102,
     678             :         0x211A,    0x2115,         0,    0x301A,
     679             :         0x301B,    0xEC22,    0xEC23,    0xEC24,
     680             :         0xEC25,    0xEC26,    0xEC27,         0,
     681             :     // F0b0
     682             :         0xEE04,    0xEE05,    0xEE06,         0,
     683             :              0,    0xEE07,    0xEE08,    0xEE09,
     684             :              0,         0,    0xEE0A,    0xEE0B,
     685             :         0xEE0C,         0,         0,         0,
     686             :     // F0c0
     687             :         0xEE0D,    0xEE0E,    0xEE0F,    0xEE10,
     688             :              0,         0,         0,         0,
     689             :              0,         0,         0,         0,
     690             :              0,         0,         0,         0,
     691             :     // F0d0
     692             :              0,    0xEE11,    0xEE12,    0xEE13,
     693             :              0,    0xEE15,    0xEE16,         0,
     694             :              0,         0,         0,         0,
     695             :              0,         0,         0,         0,
     696             :     // F0e0
     697             :              0,         0,         0,         0,
     698             :              0,         0,         0,    0xF8FF,
     699             :         0x0160,    0x00DD,    0x00DE,    0x00D0,
     700             :         0x0161,    0x00FD,    0x00FE,    0x00F0,
     701             :     // F0f0
     702             :         0xFB01,    0xFB02,    0x0131,    0x00B9,
     703             :         0x00B2,    0x00B3,    0x00BD,    0x00BC,
     704             :         0x00BE,    0x2044,    0x00A6,    0x02DD,
     705             :         0x02D8,    0x02C7,    0x02DA,    0x02DB,
     706             : };
     707             : 
     708             : static const sal_Unicode aAdobeSymbolToAppleSymbolTab[224] =
     709             : {
     710             :     // F020
     711             :         0x0020,    0x0021,    0x2200,    0x0023,
     712             :         0x2203,    0x0025,    0x0026,    0x220D,
     713             :         0x0028,    0x0029,    0x2217,    0x002B,
     714             :         0x002C,    0x2212,    0x002E,    0x002F,
     715             :     // F030
     716             :         0x0030,    0x0031,    0x0032,    0x0033,
     717             :         0x0034,    0x0035,    0x0036,    0x0037,
     718             :         0x0038,    0x0039,    0x003A,    0x003B,
     719             :         0x003C,    0x003D,    0x003E,    0x003F,
     720             :     // F040
     721             :         0x2245,    0x0391,    0x0392,    0x03A7,
     722             :         0x0394,    0x0395,    0x03A6,    0x0393,
     723             :         0x0397,    0x0399,    0x03D1,    0x039A,
     724             :         0x039B,    0x039C,    0x039D,    0x039F,
     725             :     // F050
     726             :         0x03A0,    0x0398,    0x03A1,    0x03A3,
     727             :         0x03A4,    0x03A5,    0x03C2,    0x03A9,
     728             :         0x039E,    0x03A8,    0x0396,    0x005B,
     729             :         0x2234,    0x005D,    0x22A5,    0x005F,
     730             :     // F060
     731             :         0xF8E5,    0x03B1,    0x03B2,    0x03C7,
     732             :         0x03B4,    0x03B5,    0x03C6,    0x03B3,
     733             :         0x03B7,    0x03B9,    0x03D5,    0x03BA,
     734             :         0x03BB,    0x03BC,    0x03BD,    0x03BF,
     735             :     // F070
     736             :         0x03C0,    0x03B8,    0x03C1,    0x03C3,
     737             :         0x03C4,    0x03C5,    0x03D6,    0x03C9,
     738             :         0x03BE,    0x03C8,    0x03B6,    0x007B,
     739             :         0x007C,    0x007D,    0x223C,    0x007F,
     740             :     // F080
     741             :         0x0080,    0x0081,    0x0082,    0x0083,
     742             :         0x0084,    0x0085,    0x0086,    0x0087,
     743             :         0x0088,    0x0089,    0x008A,    0x008B,
     744             :         0x008C,    0x008D,    0x008E,    0x008F,
     745             :     // F090
     746             :         0x0090,    0x0091,    0x0092,    0x0093,
     747             :         0x0094,    0x0095,    0x0096,    0x0097,
     748             :         0x0098,    0x0099,    0x009A,    0x009B,
     749             :         0x009C,    0x009D,    0x009E,    0x009F,
     750             :     // F0a0
     751             :         0x20AC,    0x03D2,    0x2032,    0x2264,
     752             :         0x2044,    0x221E,    0x0192,    0x2663,
     753             :         0x2666,    0x2665,    0x2660,    0x2194,
     754             :         0x2190,    0x2191,    0x2192,    0x2193,
     755             :     // F0b0
     756             :         0x00B0,    0x00B1,    0x2033,    0x2065,
     757             :         0x00D7,    0x221D,    0x2202,    0x2022,
     758             :         0x00F7,    0x2260,    0x2261,    0x2248,
     759             :         0x2026,    0x23D0,    0x23AF,    0x21B5,
     760             :     // F0c0
     761             :         0x2135,    0x2111,    0x211C,    0x2118,
     762             :         0x2297,    0x2295,    0x2205,    0x2229,
     763             :         0x222A,    0x2283,    0x2287,    0x2284,
     764             :         0x2282,    0x2286,    0x2208,    0x2209,
     765             :     // F0d0
     766             :         0x2220,    0x2207,    0x00AE,    0x00A9,
     767             :         0x2122,    0x220F,    0x221A,    0x22C5,
     768             :         0x00AC,    0x2227,    0x2228,    0x21D4,
     769             :         0x21D0,    0x21D1,    0x21D2,    0x21D3,
     770             :     // F0e0
     771             :         0x25CA,    0x3008,    0x00AE,    0x00A9,
     772             :         0x2122,    0x2211,    0x239B,    0x239C,
     773             :         0x239D,    0x23A1,    0x23A2,    0x23A3,
     774             :         0x23A7,    0x23A8,    0x23A9,    0x23AA,
     775             :     // F0f0
     776             :         0xF8FF,    0x3009,    0x222B,    0x2320,
     777             :         0x23AE,    0x2321,    0x239E,    0x239F,
     778             :         0x23A0,    0x23A4,    0x23A5,    0x23A6,
     779             :         0x23AB,    0x23AC,    0x23AD,    0x00FF
     780             : };
     781             : 
     782           0 : static sal_Unicode ImplStarSymbolToStarBats( sal_Unicode c )
     783             : {
     784           0 :     switch ( c )
     785             :     {
     786           0 :         case 0x00A2: c = 0xF0E0; break;
     787           0 :         case 0x00A4: c = 0xF0E1; break;
     788           0 :         case 0x00A5: c = 0xF0E2; break;
     789           0 :         case 0x00A7: c = 0xF0A7; break;
     790           0 :         case 0x00AB: c = 0xF0AB; break;
     791           0 :         case 0x00B6: c = 0xF0DE; break;
     792           0 :         case 0x00BB: c = 0xF0BB; break;
     793             : 
     794           0 :         case 0x0152: c = 0xF08C; break;
     795           0 :         case 0x0153: c = 0xF09C; break;
     796           0 :         case 0x0160: c = 0xF08A; break;
     797           0 :         case 0x0161: c = 0xF09A; break;
     798           0 :         case 0x0178: c = 0xF09F; break;
     799           0 :         case 0x017D: c = 0xF08E; break;
     800           0 :         case 0x017E: c = 0xF09E; break;
     801             : 
     802           0 :         case 0x0192: c = 0xF083; break;
     803           0 :         case 0x02C6: c = 0xF088; break;
     804           0 :         case 0x02DC: c = 0xF098; break;
     805           0 :         case 0x2013: c = 0xF096; break;
     806           0 :         case 0x2014: c = 0xF097; break;
     807           0 :         case 0x2018: c = 0xF091; break;
     808             : 
     809           0 :         case 0x2019: c = 0xF092; break;
     810           0 :         case 0x201A: c = 0xF082; break;
     811           0 :         case 0x201C: c = 0xF093; break;
     812           0 :         case 0x201D: c = 0xF094; break;
     813           0 :         case 0x201E: c = 0xF084; break;
     814           0 :         case 0x2020: c = 0xF086; break;
     815             : 
     816           0 :         case 0x2021: c = 0xF087; break;
     817           0 :         case 0x2022: c = 0xF095; break;
     818           0 :         case 0x2026: c = 0xF085; break;
     819           0 :         case 0x2030: c = 0xF089; break;
     820           0 :         case 0x2039: c = 0xF08B; break;
     821           0 :         case 0x203A: c = 0xF09B; break;
     822             : 
     823           0 :         case 0x20A1: c = 0xF0E4; break;
     824           0 :         case 0x20A2: c = 0xF0E5; break;
     825           0 :         case 0x20A3: c = 0xF0E6; break;
     826           0 :         case 0x20A4: c = 0xF0E7; break;
     827           0 :         case 0x20A8: c = 0xF0EA; break;
     828           0 :         case 0x20A9: c = 0xF0E8; break;
     829           0 :         case 0x20AB: c = 0xF0E9; break;
     830           0 :         case 0x20AC: c = 0xF080; break;
     831             : 
     832           0 :         case 0x2122: c = 0xF099; break;
     833           0 :         case 0x2190: c = 0xF0B7; break;
     834           0 :         case 0x2191: c = 0xF0B8; break;
     835           0 :         case 0x2192: c = 0xF0B5; break;
     836           0 :         case 0x2193: c = 0xF0B6; break;
     837           0 :         case 0x2194: c = 0xF0D8; break;
     838           0 :         case 0x2195: c = 0xF0D9; break;
     839             : 
     840           0 :         case 0x21E4: c = 0xF0B4; break;
     841           0 :         case 0x21E5: c = 0xF0B3; break;
     842           0 :         case 0x21E6: c = 0xF0A4; break;
     843           0 :         case 0x21E7: c = 0xF0B2; break;
     844           0 :         case 0x21E8: c = 0xF0AF; break;
     845           0 :         case 0x21E9: c = 0xF0A3; break;
     846             : 
     847           0 :         case 0x25A0: c = 0xF024; break;
     848           0 :         case 0x25A1: c = 0xF025; break;
     849           0 :         case 0x25B4: c = 0xF0C5; break;
     850           0 :         case 0x25B5: c = 0xF0C7; break;
     851           0 :         case 0x25BE: c = 0xF0C4; break;
     852           0 :         case 0x25BF: c = 0xF0C6; break;
     853           0 :         case 0x25C6: c = 0xF043; break;
     854           0 :         case 0x25CF: c = 0xF022; break;
     855           0 :         case 0x25D7: c = 0xF0D0; break;
     856             : 
     857           0 :         case 0x260E: c = 0xF074; break;
     858           0 :         case 0x2611: c = 0xF034; break;
     859           0 :         case 0x2612: c = 0xF033; break;
     860           0 :         case 0x261B: c = 0xF036; break;
     861           0 :         case 0x261E: c = 0xF07D; break;
     862           0 :         case 0x2639: c = 0xF0AD; break;
     863           0 :         case 0x263A: c = 0xF021; break;
     864             : 
     865           0 :         case 0x2702: c = 0xF0CB; break;
     866           0 :         case 0x2708: c = 0xF0CC; break;
     867           0 :         case 0x270D: c = 0xF07E; break;
     868           0 :         case 0x270E: c = 0xF038; break;
     869             : 
     870           0 :         case 0x2713: c = 0xF039; break;
     871           0 :         case 0x2714: c = 0xF03A; break;
     872           0 :         case 0x2717: c = 0xF04F; break;
     873           0 :         case 0x2718: c = 0xF050; break;
     874           0 :         case 0x2719: c = 0xF051; break;
     875           0 :         case 0x271A: c = 0xF052; break;
     876           0 :         case 0x271B: c = 0xF053; break;
     877           0 :         case 0x271C: c = 0xF054; break;
     878             : 
     879           0 :         case 0x2721: c = 0xF0CD; break;
     880           0 :         case 0x2722: c = 0xF044; break;
     881           0 :         case 0x2723: c = 0xF045; break;
     882           0 :         case 0x2724: c = 0xF046; break;
     883           0 :         case 0x2725: c = 0xF047; break;
     884           0 :         case 0x272B: c = 0xF055; break;
     885           0 :         case 0x272C: c = 0xF056; break;
     886           0 :         case 0x272D: c = 0xF057; break;
     887           0 :         case 0x272E: c = 0xF058; break;
     888           0 :         case 0x272F: c = 0xF059; break;
     889             : 
     890           0 :         case 0x2730: c = 0xF05A; break;
     891           0 :         case 0x2733: c = 0xF048; break;
     892           0 :         case 0x2734: c = 0xF049; break;
     893           0 :         case 0x2735: c = 0xF04A; break;
     894           0 :         case 0x2736: c = 0xF04B; break;
     895           0 :         case 0x2737: c = 0xF04C; break;
     896           0 :         case 0x2738: c = 0xF04D; break;
     897           0 :         case 0x2739: c = 0xF04E; break;
     898           0 :         case 0x273F: c = 0xF0CE; break;
     899             : 
     900           0 :         case 0x2744: c = 0xF0CF; break;
     901           0 :         case 0x274D: c = 0xF023; break;
     902           0 :         case 0x274F: c = 0xF03E; break;
     903           0 :         case 0x2750: c = 0xF03F; break;
     904           0 :         case 0x2751: c = 0xF027; break;
     905           0 :         case 0x2752: c = 0xF028; break;
     906           0 :         case 0x2756: c = 0xF02C; break;
     907           0 :         case 0x2759: c = 0xF0D1; break;
     908           0 :         case 0x2762: c = 0xF0D4; break;
     909             : 
     910           0 :         case 0x2780: c = 0xF068; break;
     911           0 :         case 0x2781: c = 0xF069; break;
     912           0 :         case 0x2782: c = 0xF06A; break;
     913           0 :         case 0x2783: c = 0xF06B; break;
     914           0 :         case 0x2784: c = 0xF06C; break;
     915           0 :         case 0x2785: c = 0xF06D; break;
     916           0 :         case 0x2786: c = 0xF06E; break;
     917           0 :         case 0x2787: c = 0xF06F; break;
     918           0 :         case 0x2788: c = 0xF070; break;
     919           0 :         case 0x2789: c = 0xF071; break;
     920           0 :         case 0x278A: c = 0xF05D; break;
     921           0 :         case 0x278B: c = 0xF05E; break;
     922           0 :         case 0x278C: c = 0xF05F; break;
     923           0 :         case 0x278D: c = 0xF060; break;
     924           0 :         case 0x278E: c = 0xF061; break;
     925           0 :         case 0x278F: c = 0xF062; break;
     926             : 
     927           0 :         case 0x2790: c = 0xF063; break;
     928           0 :         case 0x2791: c = 0xF064; break;
     929           0 :         case 0x2792: c = 0xF065; break;
     930           0 :         case 0x2793: c = 0xF066; break;
     931           0 :         case 0x2794: c = 0xF031; break;
     932           0 :         case 0x2798: c = 0xF0DA; break;
     933           0 :         case 0x279A: c = 0xF0DB; break;
     934             : 
     935           0 :         case 0x27A2: c = 0xF02F; break;
     936           0 :         case 0x27B2: c = 0xF035; break;
     937           0 :         case 0x27B8: c = 0xF0DC; break;
     938             : 
     939           0 :         case 0xE000: c = 0xF000+38; break;
     940           0 :         case 0xE001: c = 0xF000+41; break;
     941           0 :         case 0xE002: c = 0xF000+42; break;
     942           0 :         case 0xE003: c = 0xF000+43; break;
     943           0 :         case 0xE004: c = 0xF000+45; break;
     944           0 :         case 0xE005: c = 0xF000+46; break;
     945           0 :         case 0xE006: c = 0xF000+48; break;
     946           0 :         case 0xE007: c = 0xF000+57; break;
     947             : 
     948           0 :         case 0xE008: c = 0xF000+59; break;
     949           0 :         case 0xE009: c = 0xF000+60; break;
     950           0 :         case 0xE00a: c = 0xF000+61; break;
     951           0 :         case 0xE00b: c = 0xF000+64; break;
     952           0 :         case 0xE00c: c = 0xF000+65; break;
     953           0 :         case 0xE00d: c = 0xF000+66; break;
     954           0 :         case 0xE00e: c = 0xF000+67; break;
     955           0 :         case 0xE00f: c = 0xF000+92; break;
     956             : 
     957           0 :         case 0xE010: c = 0xF000+103; break;
     958           0 :         case 0xE011: c = 0xF000+114; break;
     959           0 :         case 0xE012: c = 0xF000+115; break;
     960           0 :         case 0xE013: c = 0xF000+117; break;
     961           0 :         case 0xE014: c = 0xF000+118; break;
     962           0 :         case 0xE015: c = 0xF000+119; break;
     963           0 :         case 0xE016: c = 0xF000+120; break;
     964           0 :         case 0xE017: c = 0xF000+121; break;
     965             : 
     966           0 :         case 0xE018: c = 0xF000+122; break;
     967           0 :         case 0xE019: c = 0xF000+123; break;
     968           0 :         case 0xE01a: c = 0xF000+124; break;
     969           0 :         case 0xE01b: c = 0xF000+126; break;
     970           0 :         case 0xE01c: c = 0xF000+136; break;
     971           0 :         case 0xE01d: c = 0xF000+155; break;
     972           0 :         case 0xE01e: c = 0xF000+165; break;
     973           0 :         case 0xE01f: c = 0xF000+166; break;
     974             : 
     975           0 :         case 0xE020: c = 0xF000+168; break;
     976           0 :         case 0xE021: c = 0xF000+169; break;
     977           0 :         case 0xE022: c = 0xF000+170; break;
     978           0 :         case 0xE023: c = 0xF000+172; break;
     979           0 :         case 0xE024: c = 0xF000+174; break;
     980           0 :         case 0xE025: c = 0xF000+175; break;
     981           0 :         case 0xE026: c = 0xF000+176; break;
     982           0 :         case 0xE027: c = 0xF000+177; break;
     983             : 
     984           0 :         case 0xE028: c = 0xF000+178; break;
     985           0 :         case 0xE029: c = 0xF000+185; break;
     986           0 :         case 0xE02a: c = 0xF000+186; break;
     987           0 :         case 0xE02b: c = 0xF000+188; break;
     988           0 :         case 0xE02c: c = 0xF000+189; break;
     989           0 :         case 0xE02d: c = 0xF000+190; break;
     990           0 :         case 0xE02e: c = 0xF000+191; break;
     991           0 :         case 0xE02f: c = 0xF000+192; break;
     992             : 
     993           0 :         case 0xE030: c = 0xF000+193; break;
     994           0 :         case 0xE031: c = 0xF000+194; break;
     995           0 :         case 0xE032: c = 0xF000+195; break;
     996           0 :         case 0xE033: c = 0xF000+200; break;
     997           0 :         case 0xE034: c = 0xF000+201; break;
     998           0 :         case 0xE035: c = 0xF000+202; break;
     999           0 :         case 0xE036: c = 0xF000+210; break;
    1000           0 :         case 0xE037: c = 0xF000+211; break;
    1001             : 
    1002           0 :         case 0xE038: c = 0xF000+227; break;
    1003           0 :         case 0xE039: c = 0xF000+235; break;
    1004           0 :         case 0xE03a: c = 0xF000+255; break;
    1005             : 
    1006           0 :         default: c = 0; break;
    1007             :     }
    1008             : 
    1009           0 :     return c;
    1010             : }
    1011             : 
    1012             : enum SymbolFont
    1013             : {
    1014             :     Symbol=1, Wingdings=2, MonotypeSorts=4, Webdings=8, Wingdings2=16,
    1015             :     Wingdings3=32, MTExtra=64, TimesNewRoman=128
    1016             : };
    1017             : 
    1018             : const char *aSymbolNames[] =
    1019             : {
    1020             :     "Symbol", "Wingdings", "Monotype Sorts", "Webdings", "Wingdings 2",
    1021             :     "Wingdings 3", "MT Extra", "Times New Roman"
    1022             : };
    1023             : 
    1024             : struct SymbolEntry
    1025             : {
    1026             :     sal_uInt8 cIndex;
    1027             :     enum SymbolFont eFont;
    1028             : };
    1029             : 
    1030         472 : class StarSymbolToMSMultiFontImpl : public StarSymbolToMSMultiFont
    1031             : {
    1032             : private:
    1033             :     ::std::multimap<sal_Unicode, SymbolEntry> maMagicMap;
    1034             : public:
    1035             :     explicit StarSymbolToMSMultiFontImpl(bool bPerfectOnly);
    1036             :     OUString ConvertChar(sal_Unicode &rChar) SAL_OVERRIDE;
    1037             :     OUString ConvertString(OUString &rString, sal_Int32& rIndex) SAL_OVERRIDE;
    1038             : };
    1039             : 
    1040             : struct ExtraTable { sal_Unicode cStar; sal_uInt8 cMS;};
    1041             : 
    1042             : ExtraTable aWingDingsExtraTab[] =
    1043             : {
    1044             :     {0x25cf, 0x6C}, {0x2714, 0xFC}, {0x2717, 0xFB}, {0x2794, 0xE8},
    1045             :     {0x27a2, 0xD8}, {0xe000, 0x6F}, {0xe001, 0x73}, {0xe002, 0x74},
    1046             :     {0xe003, 0x75}, {0xe004, 0x77}, {0xe005, 0xA6}, {0xe006, 0xE0},
    1047             :     {0xe007, 0xFC}, {0xe008, 0x6C}, {0xe009, 0x6D}, {0xe00a, 0x6E},
    1048             :     {0xe00b, 0x72}, {0xe00c, 0x75}, {0xe00d, 0x76}, {0xe00e, 0x74},
    1049             :     {0xe00f, 0x8B}, {0xe010, 0x80}, {0xe011, 0x2B}, {0xe012, 0x3A},
    1050             :     {0xe013, 0x5D}, {0xe014, 0x29}, {0xe015, 0x3A}, {0xe016, 0x3C},
    1051             :     {0xe017, 0x38}, {0xe018, 0x3A}, {0xe019, 0x2A}, {0xe01a, 0x2B},
    1052             :     {0xe01b, 0x3F}, {0xe01c, 0x9F}, {0xe01d, 0x80}, {0xe01e, 0x8B},
    1053             :     {0xe023, 0x4A}, {0xe025, 0xF0}, {0xe026, 0xF2}, {0xe027, 0xEF},
    1054             :     {0xe028, 0xF1}, {0xe029, 0x52}, {0xe02a, 0x29}, {0xe02b, 0xE0},
    1055             :     {0xe02c, 0xE2}, {0xe02d, 0xDF}, {0xe02e, 0xE1}, {0xe02f, 0xAC},
    1056             :     {0xe030, 0xAD}, {0xe031, 0xAE}, {0xe032, 0x7C}, {0xe033, 0x43},
    1057             :     {0xe034, 0x4D}, {0xe0aa, 0x71}, {0xe422, 0x44}
    1058             : };
    1059             : 
    1060             : ExtraTable aSymbolExtraTab2[] =
    1061             : {
    1062             :     {0x0020, 0x20}, {0x00A0, 0x20}, {0x0021, 0x21}, {0x2200, 0x22},
    1063             :     {0x0023, 0x23}, {0x2203, 0x24}, {0x0025, 0x25}, {0x0026, 0x26},
    1064             :     {0x220B, 0x27}, {0x0028, 0x28}, {0x0029, 0x29}, {0x2217, 0x2A},
    1065             :     {0x002B, 0x2B}, {0x002C, 0x2C}, {0x2212, 0x2D}, {0x002E, 0x2E},
    1066             :     {0x002F, 0x2F}, {0x003A, 0x3A}, {0x003B, 0x3B}, {0x003C, 0x3C},
    1067             :     {0x003D, 0x3D}, {0x003E, 0x3E}, {0x2245, 0x40}, {0x2206, 0x44},
    1068             :     {0x2126, 0x57}, {0x005B, 0x5B}, {0x005D, 0x5D}, {0x22A5, 0x5E},
    1069             :     {0x03C6, 0x66}, {0x03D5, 0x6A}, {0x00B5, 0x6D}, {0x007B, 0x7B},
    1070             :     {0x007C, 0x7C}, {0x007D, 0x7D}, {0x223C, 0x7E}, {0x20AC, 0xA0},
    1071             :     {0x2032, 0xA2}, {0x2264, 0xA3}, {0x2044, 0xA4}, {0x221E, 0xA5},
    1072             :     {0x0192, 0xA6}, {0x2663, 0xA7}, {0x2665, 0xA9}, {0x2660, 0xAA},
    1073             :     {0x2194, 0xAB}, {0x2190, 0xAC}, {0x2191, 0xAD}, {0x2192, 0xAE},
    1074             :     {0x2193, 0xAF}, {0x00B0, 0xB0}, {0x00B1, 0xB1}, {0x2265, 0xB3},
    1075             :     {0x00D7, 0xB4}, {0x221D, 0xB5}, {0x2202, 0xB6}, {0x2022, 0xB7},
    1076             :     {0x00F7, 0xB8}, {0x2260, 0xB9}, {0x2261, 0xBA}, {0x2248, 0xBB},
    1077             :     {0x2026, 0xBC}, {0x21B5, 0xBF}, {0x2135, 0xC0}, {0x2111, 0xC1},
    1078             :     {0x211C, 0xC2}, {0x2118, 0xC3}, {0x2297, 0xC4}, {0x2295, 0xC5},
    1079             :     {0x2205, 0xC6}, {0x2229, 0xC7}, {0x222A, 0xC8}, {0x2283, 0xC9},
    1080             :     {0x2287, 0xCA}, {0x2284, 0xCB}, {0x2282, 0xCC}, {0x2286, 0xCD},
    1081             :     {0x2208, 0xCE}, {0x2209, 0xCF}, {0x2207, 0xD1}, {0x220F, 0xD5},
    1082             :     {0x221A, 0xD6}, {0x22C5, 0xD7}, {0x00AC, 0xD8}, {0x2227, 0xD9},
    1083             :     {0x2228, 0xDA}, {0x21D4, 0xDB}, {0x21D0, 0xDC}, {0x21D2, 0xDE},
    1084             :     {0x2329, 0xE1}, {0x2211, 0xE5}, {0x232A, 0xF1}, {0x222B, 0xF2},
    1085             :     {0x2320, 0xF3}, {0x2321, 0xF5}, {0x2013, 0x2D}
    1086             : };
    1087             : 
    1088             : ExtraTable aSymbolExtraTab[] =
    1089             : {
    1090             :     {0xe021, 0xD3}, {0xe024, 0xD2}, {0xe035, 0x20}, {0xe036, 0x28},
    1091             :     {0xe037, 0x29}, {0xe039, 0x20}, {0xe083, 0x2B}, {0xe084, 0x3C},
    1092             :     {0xe085, 0x3E}, {0xe086, 0xA3}, {0xe087, 0xB3}, {0xe089, 0xCE},
    1093             :     {0xe08a, 0xA6}, {0xe08c, 0xAE}, {0xe08d, 0xD6}, {0xe08e, 0xD6},
    1094             :     {0xe08f, 0xD6}, {0xe094, 0xA2}, {0xe09e, 0x28}, {0xe09f, 0x29},
    1095             :     {0xe0a0, 0xD0}, {0xe0a6, 0xA2}, {0xe0a7, 0x7C}, {0xe0a8, 0x2F},
    1096             :     {0xe0ab, 0x7C}, {0xe0ac, 0x47}, {0xe0ad, 0x44}, {0xe0ae, 0x51},
    1097             :     {0xe0af, 0x4C}, {0xe0b0, 0x58}, {0xe0b1, 0x50}, {0xe0b2, 0x53},
    1098             :     {0xe0b3, 0x55}, {0xe0b4, 0x46}, {0xe0b5, 0x59}, {0xe0b6, 0x57},
    1099             :     {0xe0b7, 0x61}, {0xe0b8, 0x62}, {0xe0b9, 0x67}, {0xe0ba, 0x64},
    1100             :     {0xe0bb, 0x65}, {0xe0bc, 0x7A}, {0xe0bd, 0x68}, {0xe0be, 0x71},
    1101             :     {0xe0bf, 0x69}, {0xe0c0, 0x6B}, {0xe0c1, 0x6C}, {0xe0c2, 0x6D},
    1102             :     {0xe0c3, 0x6E}, {0xe0c4, 0x78}, {0xe0c5, 0x6F}, {0xe0c6, 0x70},
    1103             :     {0xe0c7, 0x72}, {0xe0c8, 0x73}, {0xe0c9, 0x74}, {0xe0ca, 0x75},
    1104             :     {0xe0cb, 0x66}, {0xe0cc, 0x63}, {0xe0cd, 0x79}, {0xe0ce, 0x77},
    1105             :     {0xe0cf, 0x65}, {0xe0d0, 0x4A}, {0xe0d1, 0x76}, {0xe0d3, 0x56},
    1106             :     {0xe0d4, 0x6A}, {0xe0d5, 0xB6}, {0xe0d6, 0x69}, {0xe0db, 0xAC},
    1107             :     {0xe0dc, 0xAD}, {0xe0dd, 0xAF}
    1108             : };
    1109             : 
    1110             : ExtraTable aTNRExtraTab[] =
    1111             : {
    1112             :     {0xe021, 0xA9},
    1113             :     {0xe022, 0x40},
    1114             :     {0xe024, 0xAE},
    1115             :     {0xe035, 0x20},
    1116             :     {0xe036, '('},
    1117             :     {0xe037, ')'},
    1118             :     {0xe039, 0x20},
    1119             :     {0xe03a, 0x80},
    1120             :     {0xe080, 0x89},
    1121             :     {0xe083, '+'},
    1122             :     {0xe084, '<'},
    1123             :     {0xe085, '>'},
    1124             :     {0xe0a9, '\\'}
    1125             : };
    1126             : 
    1127         236 : StarSymbolToMSMultiFontImpl::StarSymbolToMSMultiFontImpl(bool bPerfectOnly)
    1128             : {
    1129             :     struct ConvertTable
    1130             :     {
    1131             :         enum SymbolFont meFont;
    1132             :         const sal_Unicode* pTab;
    1133             :     };
    1134             : 
    1135             :     //In order of preference
    1136             :     const ConvertTable aConservativeTable[] =
    1137             :     {
    1138             :         {Symbol,         aAdobeSymbolTab},
    1139             :         {Wingdings,      aWingDingsTab},
    1140             :         {MonotypeSorts,  aMonotypeSortsTab},
    1141             :         {Webdings,       aWebDingsTab},
    1142             :         {Wingdings2,     aWingDings2Tab},
    1143             :         {Wingdings3,     aWingDings3Tab},
    1144             :         {MTExtra,        aMTExtraTab}
    1145         236 :     };
    1146             : 
    1147             :     struct ExtendedConvertTable
    1148             :     {
    1149             :         enum SymbolFont meFont;
    1150             :         const ExtraTable *mpTable;
    1151             :         size_t mnSize;
    1152         944 :         ExtendedConvertTable(SymbolFont eFont, const ExtraTable *pTable,
    1153             :             size_t nSize)
    1154         944 :             : meFont(eFont), mpTable(pTable), mnSize(nSize) {}
    1155             :     };
    1156             : 
    1157             :     //Reverse map from a given starsymbol char to exact matches in ms symbol
    1158             :     //fonts.
    1159         236 :     int nEntries = SAL_N_ELEMENTS(aConservativeTable);
    1160             :     int i;
    1161        1888 :     for (i = 0; i < nEntries; ++i)
    1162             :     {
    1163        1652 :         const ConvertTable& r = aConservativeTable[i];
    1164             :         SymbolEntry aEntry;
    1165        1652 :         aEntry.eFont = r.meFont;
    1166      371700 :         for (aEntry.cIndex = 0xFF; aEntry.cIndex >= 0x20; --aEntry.cIndex)
    1167             :         {
    1168      370048 :             if (sal_Unicode cChar = r.pTab[aEntry.cIndex-0x20])
    1169             :                 maMagicMap.insert(
    1170             :                     ::std::multimap<sal_Unicode, SymbolEntry>::value_type(
    1171      327096 :                     cChar, aEntry));
    1172             :         }
    1173             :     }
    1174             : 
    1175             :     //In order of preference
    1176             :     const ExtendedConvertTable aAgressiveTable[] =
    1177             :     {
    1178             :         ExtendedConvertTable(Symbol, aSymbolExtraTab2,
    1179             :             sizeof(aSymbolExtraTab2)),
    1180             :         ExtendedConvertTable(Symbol, aSymbolExtraTab,
    1181             :             sizeof(aSymbolExtraTab)),
    1182             :         ExtendedConvertTable(Wingdings, aWingDingsExtraTab,
    1183             :             sizeof(aWingDingsExtraTab)),
    1184             :         ExtendedConvertTable(TimesNewRoman, aTNRExtraTab,
    1185             :             sizeof(aTNRExtraTab))
    1186         236 :     };
    1187             : 
    1188             :      //Allow extra conversions that are not perfect, but "good enough"
    1189         236 :     if (!bPerfectOnly)
    1190         236 :         nEntries = SAL_N_ELEMENTS(aAgressiveTable);
    1191             :     else
    1192           0 :         nEntries = 1;
    1193             : 
    1194        1180 :     for (i = 0; i < nEntries; ++i)
    1195             :     {
    1196         944 :         const ExtendedConvertTable& r = aAgressiveTable[i];
    1197             :         SymbolEntry aEntry;
    1198         944 :         aEntry.eFont = r.meFont;
    1199       55932 :         for (int j = r.mnSize / sizeof(r.mpTable[0]) - 1; j >=0; --j)
    1200             :         {
    1201       54988 :             aEntry.cIndex = r.mpTable[j].cMS;
    1202             :             maMagicMap.insert(
    1203             :                 ::std::multimap<sal_Unicode, SymbolEntry>::value_type(
    1204       54988 :                 r.mpTable[j].cStar, aEntry));
    1205             :         }
    1206             :     }
    1207         236 : }
    1208             : 
    1209         215 : const char *SymbolFontToString(int nResult)
    1210             : {
    1211         215 :     const char **ppName = aSymbolNames;
    1212         215 :     int nI = Symbol;
    1213         614 :     while (nI <= nResult)
    1214             :     {
    1215         399 :         if (!(nI & nResult))
    1216         184 :             nI = nI << 1;
    1217             :         else
    1218         215 :             break;
    1219         184 :         ppName++;
    1220             :     }
    1221         215 :     return *ppName;
    1222             : }
    1223             : 
    1224         236 : OUString StarSymbolToMSMultiFontImpl::ConvertChar(sal_Unicode &rChar)
    1225             : {
    1226         236 :     OUString sRet;
    1227             : 
    1228             :     ::std::multimap<sal_Unicode, SymbolEntry>::const_iterator aResult =
    1229         236 :         maMagicMap.find(rChar);
    1230             : 
    1231         236 :     if (aResult != maMagicMap.end())
    1232             :     {
    1233         215 :         const SymbolEntry &rEntry = (*aResult).second;
    1234         215 :         const char* pc = SymbolFontToString(rEntry.eFont);
    1235         215 :         sRet = OUString(pc, strlen(pc), RTL_TEXTENCODING_ASCII_US);
    1236         215 :         rChar = rEntry.cIndex;
    1237             :     }
    1238             : 
    1239         236 :     return sRet;
    1240             : }
    1241             : 
    1242           0 : OUString StarSymbolToMSMultiFontImpl::ConvertString(OUString &rString,
    1243             :                                                     sal_Int32& rIndex)
    1244             : {
    1245             :     typedef ::std::multimap<sal_Unicode, SymbolEntry>::iterator MI;
    1246             :     typedef ::std::pair<MI, MI> Result;
    1247             : 
    1248           0 :     OUString sRet;
    1249             : 
    1250           0 :     sal_Int32 nLen = rString.getLength();
    1251           0 :     if (rIndex >= nLen)
    1252           0 :         return sRet;
    1253             : 
    1254           0 :     int nTotal = 0, nResult = 0;
    1255           0 :     ::std::vector<Result> aPossibilities;
    1256           0 :     aPossibilities.reserve(nLen - rIndex);
    1257           0 :     sal_Int32 nStart = rIndex;
    1258           0 :     do
    1259             :     {
    1260           0 :         Result aResult = maMagicMap.equal_range(rString[rIndex]);
    1261           0 :         int nBitfield = 0;
    1262           0 :         for (MI aIndex = aResult.first; aIndex != aResult.second; ++aIndex)
    1263           0 :             nBitfield |= aIndex->second.eFont;
    1264             : 
    1265           0 :         if (!nTotal)
    1266           0 :             nTotal = nBitfield;
    1267             :         else
    1268             :         {
    1269           0 :             if (nTotal != nBitfield)    //Allow a series of failures
    1270             :             {
    1271           0 :                 nTotal &= nBitfield;
    1272           0 :                 if (!nTotal)
    1273           0 :                     break;
    1274             :             }
    1275             :         }
    1276           0 :         nResult = nTotal;
    1277           0 :         if (nResult)    //Don't bother storing a series of failures
    1278           0 :             aPossibilities.push_back(aResult);
    1279           0 :         ++rIndex;
    1280           0 :     }while(rIndex < nLen);
    1281             : 
    1282           0 :     if (nResult)
    1283             :     {
    1284           0 :         int nI = Symbol;
    1285           0 :         while (nI <= nResult)
    1286             :         {
    1287           0 :             if (!(nI & nResult))
    1288           0 :                 nI = nI << 1;
    1289             :             else
    1290           0 :                 break;
    1291             :         }
    1292           0 :         const char* pc = SymbolFontToString(nI);
    1293           0 :         sRet = OUString(pc, strlen(pc), RTL_TEXTENCODING_ASCII_US);
    1294             : 
    1295           0 :         sal_Int32 nSize = aPossibilities.size();
    1296           0 :         OUStringBuffer sBuff(rString);
    1297           0 :         for(sal_Int32 nPos = 0; nPos < nSize; ++nPos)
    1298             :         {
    1299           0 :             const Result &rResult = aPossibilities[nPos];
    1300             : 
    1301           0 :             for (MI aIndex = rResult.first; aIndex != rResult.second; ++aIndex)
    1302             :             {
    1303           0 :                 if (aIndex->second.eFont == nI)
    1304             :                 {
    1305           0 :                     sBuff[nPos + nStart] = aIndex->second.cIndex;
    1306           0 :                     break;
    1307             :                 }
    1308             :             }
    1309             :         }
    1310           0 :         rString = sBuff.makeStringAndClear();
    1311             :     }
    1312             : 
    1313           0 :     return sRet;
    1314             : }
    1315             : 
    1316         236 : StarSymbolToMSMultiFont *CreateStarSymbolToMSMultiFont(bool bPerfectOnly)
    1317             : {
    1318         236 :     return new StarSymbolToMSMultiFontImpl(bPerfectOnly);
    1319             : }
    1320             : 
    1321       50926 : sal_Unicode ConvertChar::RecodeChar( sal_Unicode cChar ) const
    1322             : {
    1323       50926 :     sal_Unicode cRetVal = 0;
    1324       50926 :     if( mpCvtFunc )
    1325             :     {
    1326             :         // use a conversion function for recoding
    1327           0 :         cRetVal = mpCvtFunc( cChar );
    1328             :     }
    1329             :     else
    1330             :     {
    1331             :         // use a conversion table for recoding
    1332       50926 :         sal_Unicode cIndex = cChar;
    1333             :         // allow symbol aliasing
    1334       50926 :         if( cIndex & 0xFF00 )
    1335        1973 :             cIndex -= 0xF000;
    1336             :         // recode the symbol
    1337       50926 :         if( cIndex>=0x0020 && cIndex<=0x00FF )
    1338             :         {
    1339       50926 :             cRetVal = mpCvtTab[ cIndex - 0x0020 ];
    1340             : 
    1341       50926 :             if (!cRetVal && mpSubsFontName)
    1342             :             {
    1343           0 :                 if ( IsStarSymbol( OUString::createFromAscii(mpSubsFontName) ) )
    1344             :                 {
    1345           0 :                     cRetVal = 0xE12C;
    1346             :                     SAL_WARN( "unotools.misc", "Forcing a bullet substition from 0x" <<
    1347             :                         OString::number(cChar, 16) << " to 0x" <<
    1348             :                         OString::number(cRetVal, 16));
    1349             :                 }
    1350             :             }
    1351             :         }
    1352             :     }
    1353             : 
    1354       50926 :     return cRetVal ? cRetVal : cChar;
    1355             : }
    1356             : 
    1357             : // recode the string assuming the character codes are symbol codes
    1358             : // from an traditional symbol font (i.e. U+F020..U+F0FF)
    1359        2007 : void ConvertChar::RecodeString( OUString& rStr, sal_Int32 nIndex, sal_Int32 nLen ) const
    1360             : {
    1361        2007 :     sal_Int32 nLastIndex = nIndex + nLen;
    1362        2007 :     OUStringBuffer    aTmpStr(rStr);
    1363             : 
    1364        2007 :     if( nLastIndex > aTmpStr.getLength() )
    1365           0 :         nLastIndex = aTmpStr.getLength();
    1366             : 
    1367       54907 :     for(; nIndex < nLastIndex; ++nIndex )
    1368             :     {
    1369       52900 :         sal_Unicode cOrig = rStr[ nIndex ];
    1370             :         // only recode symbols and their U+00xx aliases
    1371       52900 :         if( ((cOrig < 0x0020) || (cOrig > 0x00FF))
    1372        3947 :         &&  ((cOrig < 0xF020) || (cOrig > 0xF0FF)) )
    1373        1974 :             continue;
    1374             : 
    1375             :         // recode a symbol
    1376       50926 :         sal_Unicode cNew = RecodeChar( cOrig );
    1377       50926 :         if( cOrig != cNew )
    1378       43505 :             aTmpStr[ nIndex ] = cNew;
    1379             :     }
    1380        2007 :     rStr = aTmpStr.makeStringAndClear();
    1381        2007 : }
    1382             : 
    1383             : struct RecodeTable { const char* pOrgName; ConvertChar aCvt;};
    1384             : 
    1385             : static const RecodeTable aStarSymbolRecodeTable[] =
    1386             : {
    1387             :     // the first two entries must be StarMath and StarBats; do not reorder!
    1388             :     // reason: fgrep for FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS
    1389             :     {"starbats",        {aStarBatsTab,  "StarSymbol", NULL}},
    1390             :     {"starmath",        {aStarMathTab,  "StarSymbol", NULL}},
    1391             : 
    1392             :     {"symbol",          {aAdobeSymbolTab, "StarSymbol", NULL}},
    1393             :     {"standardsymbols", {aAdobeSymbolTab, "StarSymbol", NULL}},
    1394             :     {"standardsymbolsl",{aAdobeSymbolTab, "StarSymbol", NULL}},
    1395             : 
    1396             :     {"monotypesorts",   {aMonotypeSortsTab, "StarSymbol", NULL}},
    1397             : //  {"monotypesorts2",  {aMonotypeSorts2Tab, "StarSymbol", NULL}}
    1398             :     {"zapfdingbats",    {aMonotypeSortsTab, "StarSymbol", NULL}},  //ZapfDingbats=MonotypeSorts-X?
    1399             :     {"itczapfdingbats", {aMonotypeSortsTab, "StarSymbol", NULL}},
    1400             :     {"dingbats",        {aMonotypeSortsTab, "StarSymbol", NULL}},
    1401             : 
    1402             :     {"webdings",        {aWebDingsTab,   "StarSymbol", NULL}},
    1403             :     {"wingdings",       {aWingDingsTab,  "StarSymbol", NULL}},
    1404             :     {"wingdings2",      {aWingDings2Tab, "StarSymbol", NULL}},
    1405             :     {"wingdings3",      {aWingDings3Tab, "StarSymbol", NULL}},
    1406             :     {"mtextra",         {aMTExtraTab, "StarSymbol", NULL}}
    1407             : };
    1408             : 
    1409             : static const RecodeTable aAppleSymbolRecodeTable[] = {
    1410             :     {"symbol",         {aAdobeSymbolToAppleSymbolTab, "AppleSymbol", NULL}}
    1411             : };
    1412             : 
    1413             : static ConvertChar aImplStarSymbolCvt = { NULL, "StarBats", ImplStarSymbolToStarBats };
    1414             : 
    1415       20238 : const ConvertChar* ConvertChar::GetRecodeData( const OUString& rOrgFontName, const OUString& rMapFontName )
    1416             : {
    1417       20238 :     const ConvertChar* pCvt = NULL;
    1418             : 
    1419             :     // clean up and lowercase font name
    1420       20238 :     OUString aOrgName( GetEnglishSearchFontName( rOrgFontName ) );
    1421       40476 :     OUString aMapName( GetEnglishSearchFontName( rMapFontName ) );
    1422             : 
    1423       40476 :     if( aMapName == "starsymbol"
    1424       20238 :      || aMapName == "opensymbol" )
    1425             :     {
    1426       20174 :         int nEntries = SAL_N_ELEMENTS(aStarSymbolRecodeTable);
    1427      205345 :         for( int i = 0; i < nEntries; ++i)
    1428             :         {
    1429      198258 :             const RecodeTable& r = aStarSymbolRecodeTable[i];
    1430      198258 :             if( aOrgName.equalsAscii( r.pOrgName ) )
    1431       13087 :                 { pCvt = &r.aCvt; break; }
    1432             :         }
    1433             :     }
    1434             :     //It's plausible that it's better to implement this
    1435             :     //as an additional encoding alongside the existing
    1436             :     //adobe-symbol to unicode conversion in rtl instead
    1437          64 :     else if( aMapName == "applesymbol" )
    1438             :     {
    1439           0 :         int nEntries = SAL_N_ELEMENTS(aAppleSymbolRecodeTable);
    1440           0 :         for( int i = 0; i < nEntries; ++i)
    1441             :         {
    1442           0 :             const RecodeTable& r = aAppleSymbolRecodeTable[i];
    1443           0 :             if( aOrgName.equalsAscii( r.pOrgName ) )
    1444           0 :                 { pCvt = &r.aCvt; break; }
    1445             :         }
    1446             :     }
    1447          64 :     else if( aMapName == "starbats" )
    1448             :     {
    1449           0 :         if( aOrgName == "starsymbol" )
    1450           0 :             pCvt = &aImplStarSymbolCvt;
    1451           0 :         else if( aOrgName == "opensymbol" )
    1452           0 :             pCvt = &aImplStarSymbolCvt;
    1453             :     }
    1454             : 
    1455       40476 :     return pCvt;
    1456             : }
    1457             : 
    1458         709 : FontToSubsFontConverter CreateFontToSubsFontConverter( const OUString& rOrgName, FontToSubsFontFlags nFlags )
    1459             : {
    1460         709 :     const ConvertChar* pCvt = NULL;
    1461             : 
    1462         709 :     OUString aName = GetEnglishSearchFontName( rOrgName );
    1463             : 
    1464         709 :     if ( nFlags & FontToSubsFontFlags::IMPORT )
    1465             :     {
    1466           0 :         int nEntries = SAL_N_ELEMENTS(aStarSymbolRecodeTable);
    1467           0 :         if ( nFlags & FontToSubsFontFlags::ONLYOLDSOSYMBOLFONTS ) // only StarMath+StarBats
    1468           0 :             nEntries = 2;
    1469           0 :         for( int i = 0; i < nEntries; ++i )
    1470             :         {
    1471           0 :             const RecodeTable& r = aStarSymbolRecodeTable[i];
    1472           0 :             if( aName.equalsAscii( r.pOrgName ) )
    1473             :             {
    1474           0 :                 pCvt = &r.aCvt;
    1475           0 :                 break;
    1476             :             }
    1477             :         }
    1478             :     }
    1479             :     else
    1480             :     {
    1481             :         // TODO: FontToSubsFontFlags::ONLYOLDSOSYMBOLFONTS
    1482         709 :         if( aName == "starsymbol" )
    1483           0 :             pCvt = &aImplStarSymbolCvt;
    1484         709 :         else if( aName == "opensymbol" )
    1485           0 :             pCvt = &aImplStarSymbolCvt;
    1486             :     }
    1487             : 
    1488         709 :     return const_cast<ConvertChar *>(pCvt);
    1489             : }
    1490             : 
    1491           0 : void DestroyFontToSubsFontConverter(
    1492             :     SAL_UNUSED_PARAMETER FontToSubsFontConverter )
    1493             : {
    1494             :     //TODO: nothing to do for now, because we use static ImplCvtChars
    1495           0 : }
    1496             : 
    1497           0 : sal_Unicode ConvertFontToSubsFontChar(
    1498             :     FontToSubsFontConverter hConverter, sal_Unicode cChar )
    1499             : {
    1500           0 :     if ( hConverter )
    1501           0 :         return static_cast<ConvertChar*>(hConverter)->RecodeChar( cChar );
    1502             :     else
    1503           0 :         return cChar;
    1504             : }
    1505             : 
    1506           0 : OUString GetFontToSubsFontName( FontToSubsFontConverter hConverter )
    1507             : {
    1508           0 :     if ( !hConverter )
    1509           0 :         return OUString();
    1510             : 
    1511           0 :     const char* pName = static_cast<ConvertChar*>(hConverter)->mpSubsFontName;
    1512           0 :     return OUString::createFromAscii( pName );
    1513             : }
    1514             : 
    1515             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11