~ubuntu-branches/ubuntu/saucy/libwpd/saucy

« back to all changes in this revision

Viewing changes to src/lib/WPXContentListener.cpp

  • Committer: Package Import Robot
  • Author(s): Rene Engelhard
  • Date: 2013-04-19 00:47:04 UTC
  • mfrom: (11.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20130419004704-j04jp8dan8plg630
Tags: 0.9.7-2
upload to unstable 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2
2
/* libwpd
 
3
 * Version: MPL 2.0 / LGPLv2.1+
 
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
 * Major Contributor(s):
3
10
 * Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch)
4
11
 *
5
 
 * This library is free software; you can redistribute it and/or
6
 
 * modify it under the terms of the GNU Library General Public
7
 
 * License as published by the Free Software Foundation; either
8
 
 * version 2 of the License, or (at your option) any later version.
9
 
 *
10
 
 * This library is distributed in the hope that it will be useful,
11
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 
 * Library General Public License for more details.
14
 
 *
15
 
 * You should have received a copy of the GNU Library General Public
16
 
 * License along with this library; if not, write to the Free Software
17
 
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 
12
 * For minor contributions see the git repository.
 
13
 *
 
14
 * Alternatively, the contents of this file may be used under the terms
 
15
 * of the GNU Lesser General Public License Version 2.1 or later
 
16
 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
 
17
 * applicable instead of those above.
18
18
 *
19
19
 * For further information visit http://libwpd.sourceforge.net
20
20
 */
216
216
 
217
217
                WPXPropertyListVector columns;
218
218
                typedef std::vector<WPXColumnDefinition>::const_iterator CDVIter;
219
 
                for (CDVIter iter = m_ps->m_textColumns.begin(); iter != m_ps->m_textColumns.end(); iter++)
 
219
                for (CDVIter iter = m_ps->m_textColumns.begin(); iter != m_ps->m_textColumns.end(); ++iter)
220
220
                {
221
221
                        WPXPropertyList column;
222
222
                        // The "style:rel-width" is expressed in twips (1440 twips per inch) and includes the left and right Gutter
266
266
                break;
267
267
        case PAGENUMBER_POSITION_TOP_CENTER:
268
268
        case PAGENUMBER_POSITION_BOTTOM_CENTER:
 
269
        case PAGENUMBER_POSITION_NONE:
 
270
        case PAGENUMBER_POSITION_TOP_LEFT_AND_RIGHT:
 
271
        case PAGENUMBER_POSITION_BOTTOM_LEFT_AND_RIGHT:
 
272
        case PAGENUMBER_POSITION_TOP_INSIDE_LEFT_AND_RIGHT:
 
273
        case PAGENUMBER_POSITION_BOTTOM_INSIDE_LEFT_AND_RIGHT:
269
274
        default:
270
275
                propList.insert("fo:text-align", "center");
271
276
                break;
317
322
 
318
323
        std::list<WPXPageSpan>::iterator currentPageSpanIter = m_pageList.begin();
319
324
        for ( unsigned i = 0; i < m_ps->m_currentPage; i++ )
320
 
                currentPageSpanIter++;
 
325
                ++currentPageSpanIter;
321
326
 
322
327
        WPXPageSpan currentPage = (*currentPageSpanIter);
323
328
 
371
376
        bool pageNumberInserted = false;
372
377
 
373
378
        std::vector<WPXHeaderFooter> headerFooterList = currentPage.getHeaderFooterList();
374
 
        for (std::vector<WPXHeaderFooter>::iterator iter = headerFooterList.begin(); iter != headerFooterList.end(); iter++)
 
379
        for (std::vector<WPXHeaderFooter>::iterator iter = headerFooterList.begin(); iter != headerFooterList.end(); ++iter)
375
380
        {
376
381
                if (((*iter).getOccurence() != NEVER) && !currentPage.getHeaderFooterSuppression((*iter).getInternalType()))
377
382
                {
472
477
 
473
478
        m_ps->m_paragraphTextIndent = m_ps->m_textIndentByParagraphIndentChange + m_ps->m_textIndentByTabs;
474
479
 
475
 
        m_ps->m_numPagesRemainingInSpan = (currentPage.getPageSpan() - 1);
 
480
        m_ps->m_numPagesRemainingInSpan = (unsigned)(currentPage.getPageSpan() - 1);
476
481
        m_ps->m_currentPage++;
477
482
}
478
483
 
569
574
                propList.insert("fo:text-align", "justify");
570
575
                propList.insert("fo:text-align-last", "justify");
571
576
                break;
 
577
        default:
 
578
                break;
572
579
        }
573
580
}
574
581
 
603
610
        if (!m_ps->m_inSubDocument && m_ps->m_firstParagraphInPageSpan)
604
611
        {
605
612
                std::list<WPXPageSpan>::iterator currentPageSpanIter = m_pageList.begin();
606
 
                for ( unsigned i = 0; i < (m_ps->m_currentPage - 1); i+=(*currentPageSpanIter).getPageSpan())
607
 
                        currentPageSpanIter++;
 
613
                for ( unsigned i = 0; i < (unsigned)(m_ps->m_currentPage - 1); i+=(unsigned)(*currentPageSpanIter).getPageSpan())
 
614
                        ++currentPageSpanIter;
608
615
 
609
616
                WPXPageSpan currentPage = (*currentPageSpanIter);
610
617
                if (currentPage.getPageNumberOverriden())
665
672
 
666
673
void WPXContentListener::_getTabStops(WPXPropertyListVector &tabStops)
667
674
{
668
 
        for (int i=0; i<(int)m_ps->m_tabStops.size(); i++)
 
675
        for (unsigned i=0; i<m_ps->m_tabStops.size(); i++)
669
676
        {
670
677
                WPXPropertyList tmpTabStop;
671
678
 
682
689
                        tmpTabStop.insert("style:type", "char");
683
690
                        tmpTabStop.insert("style:char", "."); // Assume a decimal point for now
684
691
                        break;
 
692
                case LEFT:
 
693
                case BAR:
685
694
                default:  // Left alignment is the default and BAR is not handled in OOo
686
695
                        break;
687
696
                }
927
936
        double tableWidth = 0.0;
928
937
        WPXPropertyListVector columns;
929
938
        typedef std::vector<WPXColumnDefinition>::const_iterator CDVIter;
930
 
        for (CDVIter iter = m_ps->m_tableDefinition.m_columns.begin(); iter != m_ps->m_tableDefinition.m_columns.end(); iter++)
 
939
        for (CDVIter iter = m_ps->m_tableDefinition.m_columns.begin(); iter != m_ps->m_tableDefinition.m_columns.end(); ++iter)
931
940
        {
932
941
                WPXPropertyList column;
933
942
                // The "style:rel-width" is expressed in twips (1440 twips per inch) and includes the left and right Gutter
1018
1027
                        throw ParseException();
1019
1028
                while ((unsigned long)m_ps->m_currentTableCol < (unsigned long)m_ps->m_numRowsToSkip.size())
1020
1029
                {
1021
 
                        if (!m_ps->m_numRowsToSkip[m_ps->m_currentTableCol]) // This case should not happen, but does :-(
 
1030
                        if (!m_ps->m_numRowsToSkip[(size_t)(m_ps->m_currentTableCol)]) // This case should not happen, but does :-(
1022
1031
                        {
1023
1032
                                // m_ps->m_currentTableCol++;
1024
1033
                                // Fill the table row untill the end with empty cells
1027
1036
                                _closeTableCell();
1028
1037
                        }
1029
1038
                        else
1030
 
                                m_ps->m_numRowsToSkip[m_ps->m_currentTableCol++]--;
 
1039
                                m_ps->m_numRowsToSkip[(size_t)(m_ps->m_currentTableCol++)]--;
1031
1040
                }
1032
1041
 
1033
1042
                if (m_ps->m_isTableCellOpened)
1092
1101
                throw ParseException();
1093
1102
 
1094
1103
        while ((unsigned long)m_ps->m_currentTableCol < (unsigned long)m_ps->m_numRowsToSkip.size() &&
1095
 
                m_ps->m_numRowsToSkip[m_ps->m_currentTableCol])
 
1104
                m_ps->m_numRowsToSkip[(size_t)(m_ps->m_currentTableCol)])
1096
1105
        {
1097
 
                m_ps->m_numRowsToSkip[m_ps->m_currentTableCol]--;
 
1106
                m_ps->m_numRowsToSkip[(size_t)(m_ps->m_currentTableCol)]--;
1098
1107
                m_ps->m_currentTableCol++;
1099
1108
        }
1100
1109
 
1131
1140
        m_ps->m_currentTableCellNumberInRow++;
1132
1141
        m_ps->m_isTableCellOpened = true;
1133
1142
        m_ps->m_isCellWithoutParagraph = true;
 
1143
        m_ps->m_isRowWithoutCell = false;
1134
1144
 
1135
1145
        if (m_ps->m_currentTableCol < 0)
1136
1146
                throw ParseException();
1137
1147
 
1138
1148
        while ((unsigned long)m_ps->m_currentTableCol < (unsigned long)m_ps->m_numRowsToSkip.size() &&(tmpColSpan > 0))
1139
1149
        {
1140
 
                if (m_ps->m_numRowsToSkip[m_ps->m_currentTableCol]) // This case should not happen, but it happens in real-life documents :-(
 
1150
                if (m_ps->m_numRowsToSkip[(size_t)(m_ps->m_currentTableCol)]) // This case should not happen, but it happens in real-life documents :-(
1141
1151
                {
1142
 
                        m_ps->m_numRowsToSkip[m_ps->m_currentTableCol]=0;
 
1152
                        m_ps->m_numRowsToSkip[(size_t)(m_ps->m_currentTableCol)]=0;
1143
1153
                }
1144
 
                m_ps->m_numRowsToSkip[m_ps->m_currentTableCol] += (rowSpan - 1);
 
1154
                m_ps->m_numRowsToSkip[(size_t)(m_ps->m_currentTableCol)] += (rowSpan - 1);
1145
1155
                m_ps->m_currentTableCol++;
1146
1156
                tmpColSpan--;
1147
1157
        }
1171
1181
Creates an new document state. Saves the old state on a "stack".
1172
1182
*/
1173
1183
void WPXContentListener::handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType,
1174
 
        WPXTableList tableList, int nextTableIndice)
 
1184
        WPXTableList tableList, unsigned nextTableIndice)
1175
1185
{
1176
1186
        // save our old parsing state on our "stack"
1177
1187
        WPXContentParsingState *oldPS = m_ps;
1244
1254
                        m_ps->m_isParagraphPageBreak = true;
1245
1255
                        break;
1246
1256
                        // TODO: (.. line break?)
 
1257
                default:
 
1258
                        break;
1247
1259
                }
1248
1260
 
1249
1261
                if (m_ps->m_inSubDocument)
1312
1324
                case 0x05:
1313
1325
                        m_ps->m_paragraphJustification = WPX_PARAGRAPH_JUSTIFICATION_DECIMAL_ALIGNED;
1314
1326
                        break;
 
1327
                default:
 
1328
                        break;
1315
1329
                }
1316
1330
        }
1317
1331
}
1318
1332
 
1319
1333
double WPXContentListener::_getNextTabStop() const
1320
1334
{
1321
 
        for (std::vector<WPXTabStop>::const_iterator iter = m_ps->m_tabStops.begin(); iter != (m_ps->m_tabStops.end() - 1); iter++)
 
1335
        for (std::vector<WPXTabStop>::const_iterator iter = m_ps->m_tabStops.begin(); iter != (m_ps->m_tabStops.end() - 1); ++iter)
1322
1336
        {
1323
1337
                if (iter->m_position
1324
1338
                        - (m_ps->m_isTabPositionRelative ? 0.0 : (m_ps->m_pageMarginLeft + m_ps->m_sectionMarginLeft + m_ps->m_leftMarginByParagraphMarginChange))
1336
1350
 
1337
1351
double WPXContentListener::_getPreviousTabStop() const
1338
1352
{
1339
 
        for (std::vector<WPXTabStop>::reverse_iterator riter = m_ps->m_tabStops.rbegin(); riter != (m_ps->m_tabStops.rend() - 1); riter++)
 
1353
        for (std::vector<WPXTabStop>::reverse_iterator riter = m_ps->m_tabStops.rbegin(); riter != (m_ps->m_tabStops.rend() - 1); ++riter)
1340
1354
        {
1341
1355
                if (riter->m_position
1342
1356
                        - (m_ps->m_isTabPositionRelative ? 0.0 : (m_ps->m_pageMarginLeft + m_ps->m_sectionMarginLeft + m_ps->m_leftMarginByParagraphMarginChange))
1371
1385
        return tmpString;
1372
1386
}
1373
1387
 
1374
 
WPXString WPXContentListener::_mergeColorsToString(const RGBSColor *fgColor, const RGBSColor *bgColor)
 
1388
WPXString WPXContentListener::_mergeColorsToString(const RGBSColor *fgColor,
 
1389
        const RGBSColor * /* bgColor */)
1375
1390
{
1376
1391
        WPXString tmpColor;
1377
1392
        RGBSColor tmpFgColor, tmpBgColor;
1388
1403
                tmpFgColor.m_r = tmpFgColor.m_g = tmpFgColor.m_b = 0xFF;
1389
1404
                tmpFgColor.m_s = 0x64; // 100%
1390
1405
        }
1391
 
        if (bgColor)
1392
 
        {
1393
 
                tmpBgColor.m_r = bgColor->m_r;
1394
 
                tmpBgColor.m_g = bgColor->m_g;
1395
 
                tmpBgColor.m_b = bgColor->m_b;
1396
 
                tmpBgColor.m_s = bgColor->m_s;
1397
 
        }
1398
 
        else
1399
 
        {
1400
 
                tmpBgColor.m_r = tmpBgColor.m_g = tmpBgColor.m_b = 0xFF;
1401
 
                tmpBgColor.m_s = 0x64; // 100%
1402
 
        }
1403
1406
 
1404
1407
        double fgAmount = (double)tmpFgColor.m_s/100.0;
1405
 
        double bgAmount = LIBWPD_MAX(((double)tmpBgColor.m_s-(double)tmpFgColor.m_s)/100.0, 0.0);
 
1408
        double wtAmount = 255.0*(1.0-fgAmount);
1406
1409
 
1407
 
        int bgRed = LIBWPD_MIN((int)(((double)tmpFgColor.m_r*fgAmount)+((double)tmpBgColor.m_r*bgAmount)), 255);
1408
 
        int bgGreen = LIBWPD_MIN((int)(((double)tmpFgColor.m_g*fgAmount)+((double)tmpBgColor.m_g*bgAmount)), 255);
1409
 
        int bgBlue = LIBWPD_MIN((int)(((double)tmpFgColor.m_b*fgAmount)+((double)tmpBgColor.m_b*bgAmount)), 255);
 
1410
        int bgRed   = (int)(((double)tmpFgColor.m_r*fgAmount)+wtAmount);
 
1411
        int bgGreen = (int)(((double)tmpFgColor.m_g*fgAmount)+wtAmount);
 
1412
        int bgBlue  = (int)(((double)tmpFgColor.m_b*fgAmount)+wtAmount);
1410
1413
 
1411
1414
        tmpColor.sprintf("#%.2x%.2x%.2x", bgRed, bgGreen, bgBlue);
1412
1415
 
1419
1422
                return position;
1420
1423
        double tempSpaceRemaining = position - m_ps->m_pageMarginLeft - m_ps->m_sectionMarginLeft;
1421
1424
        position -= m_ps->m_textColumns[0].m_leftGutter;
1422
 
        for (int i = 0; i < (int)(m_ps->m_textColumns.size() - 1); i++)
 
1425
        for (unsigned i = 0; i < (unsigned)(m_ps->m_textColumns.size() - 1); i++)
1423
1426
        {
1424
1427
                if ((tempSpaceRemaining -= m_ps->m_textColumns[i].m_width - m_ps->m_textColumns[i].m_rightGutter) > 0)
1425
1428
                {
1446
1449
 
1447
1450
uint32_t WPXContentListener::_mapSymbolFontCharacter(uint32_t character)
1448
1451
{
1449
 
        static const uint32_t _symbolFontMap1 [] =
1450
 
        {
1451
 
                0x0020, 0x0021, 0x2200, 0x0023, 0x2203, 0x0025, 0x0026, 0x220D, // 0x20 ..
1452
 
                0x0028, 0x0029, 0x2217, 0x002B, 0x002C, 0x2212, 0x002E, 0x002F,
1453
 
                0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
1454
 
                0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
1455
 
                0x2245, 0x0391, 0x0392, 0x03A7, 0x0394, 0x0395, 0x03A6, 0x0393,
1456
 
                0x0397, 0x0399, 0x03D1, 0x039A, 0x039B, 0x039C, 0x039D, 0x039F,
1457
 
                0x03A0, 0x0398, 0x03A1, 0x03A3, 0x03A4, 0x03A5, 0x03C2, 0x03A9,
1458
 
                0x039E, 0x03A8, 0x0396, 0x005B, 0x2234, 0x005D, 0x22A5, 0x005F,
1459
 
                0xF8E5, 0x03B1, 0x03B2, 0x03C7, 0x03B4, 0x03B5, 0x03C6, 0x03B3,
1460
 
                0x03B7, 0x03B9, 0x03D5, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BF,
1461
 
                0x03C0, 0x03B8, 0x03C1, 0x03C3, 0x03C4, 0x03C5, 0x03D6, 0x03C9,
1462
 
                0x03BE, 0x03C8, 0x03B6, 0x007B, 0x007C, 0x007D, 0x223C          // .. 0x7E
1463
 
        };
1464
 
 
1465
 
        static const uint32_t _symbolFontMap2 [] =
1466
 
        {
1467
 
                0x20AC, 0x03D2, 0x2032, 0x2264, 0x2044, 0x221E, 0x0192, 0x2663, // 0xA0 ..
1468
 
                0x2666, 0x2665, 0x2660, 0x2194, 0x2190, 0x2191, 0x2192, 0x2193,
1469
 
                0x00B0, 0x00B1, 0x2033, 0x2265, 0x00D7, 0x221D, 0x2202, 0x2022,
1470
 
                0x00F7, 0x2260, 0x2261, 0x2248, 0x2026, 0x23D0, 0x23AF, 0x21B5,
1471
 
                0x2135, 0x2111, 0x211C, 0x2118, 0x2297, 0x2295, 0x2205, 0x2229,
1472
 
                0x222A, 0x2283, 0x2287, 0x2284, 0x2282, 0x2286, 0x2208, 0x2209,
1473
 
                0x2220, 0x2207, 0x00AE, 0x00A9, 0x2122, 0x220F, 0x221A, 0x22C5,
1474
 
                0x00AC, 0x2227, 0x2228, 0x21D4, 0x21D0, 0x21D1, 0x21D2, 0x21D3,
1475
 
                0x25CA, 0x3008, 0x00AE, 0x00A9, 0x2122, 0x2211, 0x239B, 0x239C,
1476
 
                0x239D, 0x23A1, 0x23A2, 0x23A3, 0x23A7, 0x23A8, 0x23A9, 0x23AA,
1477
 
                0xF8FF, 0x3009, 0x222B, 0x2320, 0x23AE, 0x2321, 0x239E, 0x239F,
1478
 
                0x23A0, 0x23A4, 0x23A5, 0x23A6, 0x23AB, 0x23AC, 0x23AD          // .. 0xFE
1479
 
        };
1480
 
 
1481
1452
        if (character >= 0x0020 && character <= 0x7E)
 
1453
        {
 
1454
                static const uint32_t _symbolFontMap1 [] =
 
1455
                {
 
1456
                        0x0020, 0x0021, 0x2200, 0x0023, 0x2203, 0x0025, 0x0026, 0x220D, // 0x20 ..
 
1457
                        0x0028, 0x0029, 0x2217, 0x002B, 0x002C, 0x2212, 0x002E, 0x002F,
 
1458
                        0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
 
1459
                        0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
 
1460
                        0x2245, 0x0391, 0x0392, 0x03A7, 0x0394, 0x0395, 0x03A6, 0x0393,
 
1461
                        0x0397, 0x0399, 0x03D1, 0x039A, 0x039B, 0x039C, 0x039D, 0x039F,
 
1462
                        0x03A0, 0x0398, 0x03A1, 0x03A3, 0x03A4, 0x03A5, 0x03C2, 0x03A9,
 
1463
                        0x039E, 0x03A8, 0x0396, 0x005B, 0x2234, 0x005D, 0x22A5, 0x005F,
 
1464
                        0xF8E5, 0x03B1, 0x03B2, 0x03C7, 0x03B4, 0x03B5, 0x03C6, 0x03B3,
 
1465
                        0x03B7, 0x03B9, 0x03D5, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BF,
 
1466
                        0x03C0, 0x03B8, 0x03C1, 0x03C3, 0x03C4, 0x03C5, 0x03D6, 0x03C9,
 
1467
                        0x03BE, 0x03C8, 0x03B6, 0x007B, 0x007C, 0x007D, 0x223C          // .. 0x7E
 
1468
                };
 
1469
 
1482
1470
                return _symbolFontMap1[character - 0x20];
 
1471
        }
1483
1472
        if (character >= 0x00A0 && character <= 0xFE)
 
1473
        {
 
1474
                static const uint32_t _symbolFontMap2 [] =
 
1475
                {
 
1476
                        0x20AC, 0x03D2, 0x2032, 0x2264, 0x2044, 0x221E, 0x0192, 0x2663, // 0xA0 ..
 
1477
                        0x2666, 0x2665, 0x2660, 0x2194, 0x2190, 0x2191, 0x2192, 0x2193,
 
1478
                        0x00B0, 0x00B1, 0x2033, 0x2265, 0x00D7, 0x221D, 0x2202, 0x2022,
 
1479
                        0x00F7, 0x2260, 0x2261, 0x2248, 0x2026, 0x23D0, 0x23AF, 0x21B5,
 
1480
                        0x2135, 0x2111, 0x211C, 0x2118, 0x2297, 0x2295, 0x2205, 0x2229,
 
1481
                        0x222A, 0x2283, 0x2287, 0x2284, 0x2282, 0x2286, 0x2208, 0x2209,
 
1482
                        0x2220, 0x2207, 0x00AE, 0x00A9, 0x2122, 0x220F, 0x221A, 0x22C5,
 
1483
                        0x00AC, 0x2227, 0x2228, 0x21D4, 0x21D0, 0x21D1, 0x21D2, 0x21D3,
 
1484
                        0x25CA, 0x3008, 0x00AE, 0x00A9, 0x2122, 0x2211, 0x239B, 0x239C,
 
1485
                        0x239D, 0x23A1, 0x23A2, 0x23A3, 0x23A7, 0x23A8, 0x23A9, 0x23AA,
 
1486
                        0xF8FF, 0x3009, 0x222B, 0x2320, 0x23AE, 0x2321, 0x239E, 0x239F,
 
1487
                        0x23A0, 0x23A4, 0x23A5, 0x23A6, 0x23AB, 0x23AC, 0x23AD          // .. 0xFE
 
1488
                };
 
1489
 
1484
1490
                return _symbolFontMap2[character - 0xA0];
 
1491
        }
1485
1492
        return character;
1486
1493
}
1487
1494
 
1488
1495
uint32_t WPXContentListener::_mapDingbatsFontCharacter(uint32_t character)
1489
1496
{
1490
 
        static const uint32_t _dingbatsFontMap1 [] =
1491
 
        {
1492
 
                0x0020, 0x2701, 0x2702, 0x2703, 0x2704, 0x260E, 0x2706, 0x2707, // 0x20 ..
1493
 
                0x2708, 0x2709, 0x261B, 0x261E, 0x270C, 0x270D, 0x270E, 0x270F,
1494
 
                0x2710, 0x2711, 0x2712, 0x2713, 0x2714, 0x2715, 0x2716, 0x2717,
1495
 
                0x2718, 0x2719, 0x271A, 0x271B, 0x271C, 0x271D, 0x271E, 0x271F,
1496
 
                0x2720, 0x2721, 0x2722, 0x2723, 0x2724, 0x2725, 0x2726, 0x2727,
1497
 
                0x2605, 0x2729, 0x272A, 0x272B, 0x272C, 0x272D, 0x272E, 0x272F,
1498
 
                0x2730, 0x2731, 0x2732, 0x2733, 0x2734, 0x2735, 0x2736, 0x2737,
1499
 
                0x2738, 0x2739, 0x273A, 0x273B, 0x273C, 0x273D, 0x273E, 0x273F,
1500
 
                0x2740, 0x2741, 0x2742, 0x2743, 0x2744, 0x2745, 0x2746, 0x2747,
1501
 
                0x2748, 0x2749, 0x274A, 0x274B, 0x25CF, 0x274D, 0x25A0, 0x274F,
1502
 
                0x2750, 0x2751, 0x2752, 0x25B2, 0x25BC, 0x25C6, 0x2756, 0x25D7,
1503
 
                0x2758, 0x2759, 0x275A, 0x275B, 0x275C, 0x275D, 0x275E          // .. 0x7E
1504
 
        };
1505
 
 
1506
 
        static const uint32_t _dingbatsFontMap2 [] =
1507
 
        {
1508
 
                0x2768, 0x2769, 0x276A, 0x276B, 0x276C, 0x276D, 0x276E, 0x276F, // 0x80 ..
1509
 
                0x2770, 0x2771, 0x2772, 0x2773, 0x2774, 0x2775                  // .. 0x8D
1510
 
        };
1511
 
 
1512
 
        static const uint32_t _dingbatsFontMap3 [] =
1513
 
        {
1514
 
                0x2761, 0x2762, 0x2763, 0x2764, 0x2765, 0x2766, 0x2767, 0x2663, // 0xA1 ..
1515
 
                0x2666, 0x2665, 0x2660, 0x2460, 0x2461, 0x2462, 0x2463, 0x2464,
1516
 
                0x2465, 0x2466, 0x2467, 0x2468, 0x2469, 0x2776, 0x2777, 0x2778,
1517
 
                0x2779, 0x277A, 0x277B, 0x277C, 0x277D, 0x277E, 0x277F, 0x2780,
1518
 
                0x2781, 0x2782, 0x2783, 0x2784, 0x2785, 0x2786, 0x2787, 0x2788,
1519
 
                0x2789, 0x278A, 0x278B, 0x278C, 0x278D, 0x278E, 0x278F, 0x2790,
1520
 
                0x2791, 0x2792, 0x2793, 0x2794, 0x2192, 0x2194, 0x2195, 0x2798,
1521
 
                0x2799, 0x279A, 0x279B, 0x279C, 0x279D, 0x279E, 0x279F, 0x27A0,
1522
 
                0x27A1, 0x27A2, 0x27A3, 0x27A4, 0x27A5, 0x27A6, 0x27A7, 0x27A8,
1523
 
                0x27A9, 0x27AA, 0x27AB, 0x27AC, 0x27AD, 0x27AE, 0x27AF          // .. 0xEF
1524
 
        };
1525
 
 
1526
 
        static const uint32_t _dingbatsFontMap4 [] =
1527
 
        {
1528
 
                0x27B1, 0x27B2, 0x27B3, 0x27B4, 0x27B5, 0x27B6, 0x27B7, 0x27B8, // 0xF1 ..
1529
 
                0x27B9, 0x27BA, 0x27BB, 0x27BC, 0x27BD, 0x27BE                  // .. OxFE
1530
 
        };
1531
 
 
1532
1497
        if (character >= 0x20 && character <= 0x7E)
 
1498
        {
 
1499
                static const uint32_t _dingbatsFontMap1 [] =
 
1500
                {
 
1501
                        0x0020, 0x2701, 0x2702, 0x2703, 0x2704, 0x260E, 0x2706, 0x2707, // 0x20 ..
 
1502
                        0x2708, 0x2709, 0x261B, 0x261E, 0x270C, 0x270D, 0x270E, 0x270F,
 
1503
                        0x2710, 0x2711, 0x2712, 0x2713, 0x2714, 0x2715, 0x2716, 0x2717,
 
1504
                        0x2718, 0x2719, 0x271A, 0x271B, 0x271C, 0x271D, 0x271E, 0x271F,
 
1505
                        0x2720, 0x2721, 0x2722, 0x2723, 0x2724, 0x2725, 0x2726, 0x2727,
 
1506
                        0x2605, 0x2729, 0x272A, 0x272B, 0x272C, 0x272D, 0x272E, 0x272F,
 
1507
                        0x2730, 0x2731, 0x2732, 0x2733, 0x2734, 0x2735, 0x2736, 0x2737,
 
1508
                        0x2738, 0x2739, 0x273A, 0x273B, 0x273C, 0x273D, 0x273E, 0x273F,
 
1509
                        0x2740, 0x2741, 0x2742, 0x2743, 0x2744, 0x2745, 0x2746, 0x2747,
 
1510
                        0x2748, 0x2749, 0x274A, 0x274B, 0x25CF, 0x274D, 0x25A0, 0x274F,
 
1511
                        0x2750, 0x2751, 0x2752, 0x25B2, 0x25BC, 0x25C6, 0x2756, 0x25D7,
 
1512
                        0x2758, 0x2759, 0x275A, 0x275B, 0x275C, 0x275D, 0x275E          // .. 0x7E
 
1513
                };
 
1514
 
1533
1515
                return _dingbatsFontMap1[character - 0x20];
 
1516
        }
1534
1517
        if (character >= 0x80 && character <= 0x8D)
 
1518
        {
 
1519
                static const uint32_t _dingbatsFontMap2 [] =
 
1520
                {
 
1521
                        0x2768, 0x2769, 0x276A, 0x276B, 0x276C, 0x276D, 0x276E, 0x276F, // 0x80 ..
 
1522
                        0x2770, 0x2771, 0x2772, 0x2773, 0x2774, 0x2775                  // .. 0x8D
 
1523
                };
 
1524
 
1535
1525
                return _dingbatsFontMap2[character - 0x80];
 
1526
        }
1536
1527
        if (character >= 0xA1 && character <= 0xEF)
 
1528
        {
 
1529
                static const uint32_t _dingbatsFontMap3 [] =
 
1530
                {
 
1531
                        0x2761, 0x2762, 0x2763, 0x2764, 0x2765, 0x2766, 0x2767, 0x2663, // 0xA1 ..
 
1532
                        0x2666, 0x2665, 0x2660, 0x2460, 0x2461, 0x2462, 0x2463, 0x2464,
 
1533
                        0x2465, 0x2466, 0x2467, 0x2468, 0x2469, 0x2776, 0x2777, 0x2778,
 
1534
                        0x2779, 0x277A, 0x277B, 0x277C, 0x277D, 0x277E, 0x277F, 0x2780,
 
1535
                        0x2781, 0x2782, 0x2783, 0x2784, 0x2785, 0x2786, 0x2787, 0x2788,
 
1536
                        0x2789, 0x278A, 0x278B, 0x278C, 0x278D, 0x278E, 0x278F, 0x2790,
 
1537
                        0x2791, 0x2792, 0x2793, 0x2794, 0x2192, 0x2194, 0x2195, 0x2798,
 
1538
                        0x2799, 0x279A, 0x279B, 0x279C, 0x279D, 0x279E, 0x279F, 0x27A0,
 
1539
                        0x27A1, 0x27A2, 0x27A3, 0x27A4, 0x27A5, 0x27A6, 0x27A7, 0x27A8,
 
1540
                        0x27A9, 0x27AA, 0x27AB, 0x27AC, 0x27AD, 0x27AE, 0x27AF          // .. 0xEF
 
1541
                };
 
1542
 
1537
1543
                return _dingbatsFontMap3[character - 0xA1];
 
1544
        }
1538
1545
        if (character >= 0xF1 && character <=0xFE)
 
1546
        {
 
1547
                static const uint32_t _dingbatsFontMap4 [] =
 
1548
                {
 
1549
                        0x27B1, 0x27B2, 0x27B3, 0x27B4, 0x27B5, 0x27B6, 0x27B7, 0x27B8, // 0xF1 ..
 
1550
                        0x27B9, 0x27BA, 0x27BB, 0x27BC, 0x27BD, 0x27BE                  // .. OxFE
 
1551
                };
 
1552
 
1539
1553
                return _dingbatsFontMap4[character - 0xF1];
 
1554
        }
1540
1555
        return character;
1541
1556
}
1542
1557
/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */