LCOV - code coverage report
Current view: top level - unotools/source/misc - fontdefs.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 105 134 78.4 %
Date: 2012-08-25 Functions: 6 7 85.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 106 191 55.5 %

           Branch data     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 <unotools/fontdefs.hxx>
      21                 :            : #include <unotools/fontcfg.hxx>
      22                 :            : #include <boost/unordered_map.hpp>
      23                 :            : 
      24                 :            : struct ImplLocalizedFontName
      25                 :            : {
      26                 :            :     const char*         mpEnglishName;
      27                 :            :     const sal_Unicode*  mpLocalizedNames;
      28                 :            : };
      29                 :            : 
      30                 :            : // TODO: where did the 0,0 delimiters come from? A single 0 should suffice...
      31                 :            : static sal_Unicode const aBatang[] = { 0xBC14, 0xD0D5, 0, 0 };
      32                 :            : static sal_Unicode const aBatangChe[] = { 0xBC14, 0xD0D5, 0xCCB4, 0, 0 };
      33                 :            : static sal_Unicode const aGungsuh[] = { 0xAD81, 0xC11C, 0, 0 };
      34                 :            : static sal_Unicode const aGungsuhChe[] = { 0xAD81, 0xC11C, 0xCCB4, 0, 0 };
      35                 :            : static sal_Unicode const aGulim[] = { 0xAD74, 0xB9BC, 0, 0 };
      36                 :            : static sal_Unicode const aGulimChe[] = { 0xAD74, 0xB9BC, 0xCCB4, 0, 0 };
      37                 :            : static sal_Unicode const aDotum[] = { 0xB3CB, 0xC6C0, 0, 0 };
      38                 :            : static sal_Unicode const aDotumChe[] = { 0xB3CB, 0xC6C0, 0xCCB4, 0, 0 };
      39                 :            : static sal_Unicode const aSimSun[] = { 0x5B8B, 0x4F53, 0, 0 };
      40                 :            : static sal_Unicode const aNSimSun[] = { 0x65B0, 0x5B8B, 0x4F53, 0, 0 };
      41                 :            : static sal_Unicode const aSimHei[] = { 0x9ED1, 0x4F53, 0, 0 };
      42                 :            : static sal_Unicode const aSimKai[] = { 0x6977, 0x4F53, 0, 0 };
      43                 :            : static sal_Unicode const azycjkSun[] = { 0x4E2D, 0x6613, 0x5B8B, 0x4F53, 0, 0 };
      44                 :            : static sal_Unicode const azycjkHei[] = { 0x4E2D, 0x6613, 0x9ED1, 0x4F53, 0, 0 };
      45                 :            : static sal_Unicode const azycjkKai[] = { 0x4E2D, 0x6613, 0x6977, 0x4F53, 0, 0 };
      46                 :            : static sal_Unicode const aFZHei[] = { 0x65B9, 0x6B63, 0x9ED1, 0x4F53, 0, 0 };
      47                 :            : static sal_Unicode const aFZKai[] = { 0x65B9, 0x6B63, 0x6977, 0x4F53, 0, 0 };
      48                 :            : static sal_Unicode const aFZSongYI[] = { 0x65B9, 0x6B63, 0x5B8B, 0x4E00, 0, 0 };
      49                 :            : static sal_Unicode const aFZShuSong[] = { 0x65B9, 0x6B63, 0x4E66, 0x5B8B, 0, 0 };
      50                 :            : static sal_Unicode const aFZFangSong[] = { 0x65B9, 0x6B63, 0x4EFF, 0x5B8B, 0, 0 };
      51                 :            : // Attention: this fonts includes the wrong encoding vector - so we double the names with correct and wrong encoding
      52                 :            : // First one is the GB-Encoding (we think the correct one), second is the big5 encoded name
      53                 :            : static sal_Unicode const aMHei[] = { 'm', 0x7B80, 0x9ED1, 0, 'm', 0x6F60, 0x7AAA, 0, 0 };
      54                 :            : static sal_Unicode const aMKai[] = { 'm', 0x7B80, 0x6977, 0x566C, 0, 'm', 0x6F60, 0x7FF1, 0x628E, 0, 0 };
      55                 :            : static sal_Unicode const aMSong[] = { 'm', 0x7B80, 0x5B8B, 0, 'm', 0x6F60, 0x51BC, 0, 0 };
      56                 :            : static sal_Unicode const aCFangSong[] = { 'm', 0x7B80, 0x592B, 0x5B8B, 0, 'm', 0x6F60, 0x6E98, 0x51BC, 0, 0 };
      57                 :            : static sal_Unicode const aMingLiU[] = { 0x7D30, 0x660E, 0x9AD4, 0, 0 };
      58                 :            : static sal_Unicode const aPMingLiU[] = { 0x65B0, 0x7D30, 0x660E, 0x9AD4, 0, 0 };
      59                 :            : static sal_Unicode const aHei[] = { 0x6865, 0, 0 };
      60                 :            : static sal_Unicode const aKai[] = { 0x6B61, 0, 0 };
      61                 :            : static sal_Unicode const aMing[] = { 0x6D69, 0x6E67, 0, 0 };
      62                 :            : static sal_Unicode const aMSGothic[] = { 'm','s',       0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 };
      63                 :            : static sal_Unicode const aMSPGothic[] = { 'm','s','p',  0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 };
      64                 :            : static sal_Unicode const aMSMincho[] = { 'm', 's',      0x660E, 0x671D, 0 };
      65                 :            : static sal_Unicode const aMSPMincho[] = { 'm','s','p',  0x660E, 0x671D, 0 };
      66                 :            : static sal_Unicode const aMSYaHei[] = { 0x5FAE, 0x8F6F, 0x96C5, 0x9ED1, 0 };
      67                 :            : static sal_Unicode const aMSJhengHei[] = { 0x5FAE, 0x8EDF, 0x6B63, 0x9ED1, 0x9AD4, 0 };
      68                 :            : static sal_Unicode const aMeiryo[]    = { 0x30e1, 0x30a4, 0x30ea, 0x30aa, 0 };
      69                 :            : static sal_Unicode const aHGMinchoL[] = { 'h','g',      0x660E, 0x671D, 'l', 0, 0 };
      70                 :            : static sal_Unicode const aHGGothicB[] = { 'h','g',      0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 0 };
      71                 :            : static sal_Unicode const aHGPMinchoL[] = { 'h','g','p', 0x660E, 0x671D, 'l', 0 };
      72                 :            : static sal_Unicode const aHGPGothicB[] = { 'h','g','p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 0 };
      73                 :            : static sal_Unicode const aHGMinchoLSun[] = { 'h','g',   0x660E, 0x671D, 'l', 's', 'u', 'n', 0 };
      74                 :            : static sal_Unicode const aHGPMinchoLSun[] = { 'h','g','p', 0x660E, 0x671D, 'l', 's', 'u', 'n', 0 };
      75                 :            : static sal_Unicode const aHGGothicBSun[] = { 'h', 'g', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 's', 'u', 'n', 0 };
      76                 :            : static sal_Unicode const aHGPGothicBSun[] = { 'h', 'g', 'p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 's', 'u', 'n', 0 };
      77                 :            : static sal_Unicode const aHGHeiseiMin[] = { 'h', 'g', 0x5E73, 0x6210, 0x660E, 0x671D, 0x4F53, 0, 'h', 'g', 0x5E73, 0x6210, 0x660E, 0x671D, 0x4F53, 'w', '3', 'x', '1', '2', 0, 0 };
      78                 :            : static sal_Unicode const aIPAMincho[] =  { 'i', 'p', 'a', 0x660E, 0x671D, 0 };
      79                 :            : static sal_Unicode const aIPAPMincho[] = { 'i', 'p', 'a', 'p', 0x660E, 0x671D, 0 };
      80                 :            : static sal_Unicode const aIPAGothic[] =  { 'i', 'p', 'a',  0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 };
      81                 :            : static sal_Unicode const aIPAPGothic[] =  { 'i', 'p', 'a', 'p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 };
      82                 :            : static sal_Unicode const aIPAUIGothic[] =  { 'i', 'p', 'a', 'u', 'i', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 };
      83                 :            : static sal_Unicode const aTakaoMincho[] =  { 't', 'a', 'k', 'a', 'o', 0x660E, 0x671D, 0 };
      84                 :            : static sal_Unicode const aTakaoPMincho[] = { 't', 'a', 'k', 'a', 'o', 'p', 0x660E, 0x671D, 0 };
      85                 :            : static sal_Unicode const aTakaoGothic[] =  { 't', 'a', 'k', 'a', 'o',  0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 };
      86                 :            : static sal_Unicode const aTakaoPGothic[] =  { 't', 'a', 'k', 'a', 'o', 'p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 };
      87                 :            : static sal_Unicode const aSazanamiMincho[] = { 0x3055, 0x3056, 0x306A, 0x307F, 0x660E, 0x671D, 0, 0 };
      88                 :            : static sal_Unicode const aSazanamiGothic[] = { 0x3055, 0x3056, 0x306A, 0x307F, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 };
      89                 :            : static sal_Unicode const aKochiMincho[] = { 0x6771, 0x98A8, 0x660E, 0x671D, 0, 0 };
      90                 :            : static sal_Unicode const aKochiGothic[] = { 0x6771, 0x98A8, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 };
      91                 :            : static sal_Unicode const aSunDotum[] = { 0xC36C, 0xB3CB, 0xC6C0, 0, 0 };
      92                 :            : static sal_Unicode const aSunGulim[] = { 0xC36C, 0xAD74, 0xB9BC, 0, 0 };
      93                 :            : static sal_Unicode const aSunBatang[] = { 0xC36C, 0xBC14, 0xD0D5, 0, 0 };
      94                 :            : static sal_Unicode const aBaekmukDotum[] = { 0xBC31, 0xBB35, 0xB3CB, 0xC6C0, 0, 0 };
      95                 :            : static sal_Unicode const aBaekmukGulim[] = { 0xBC31, 0xBB35, 0xAD74, 0xB9BC, 0, 0 };
      96                 :            : static sal_Unicode const aBaekmukBatang[] = { 0xBC31, 0xBB35, 0xBC14, 0xD0D5, 0, 0 };
      97                 :            : static sal_Unicode const aFzMingTi[] = { 0x65B9, 0x6B63, 0x660E, 0x9AD4, 0, 0 };
      98                 :            : static sal_Unicode const aFzHeiTiTW[]= { 0x65B9, 0x6B63, 0x9ED1, 0x9AD4, 0, 0 };
      99                 :            : static sal_Unicode const aFzKaiTiTW[]= { 0x65B9, 0x6B63, 0x6977, 0x9AD4, 0, 0 };
     100                 :            : static sal_Unicode const aFzHeiTiCN[]= { 0x65B9, 0x6B63, 0x9ED1, 0x4F53, 0, 0 };
     101                 :            : static sal_Unicode const aFzKaiTiCN[]= { 0x65B9, 0x6B63, 0x6977, 0x4F53, 0, 0 };
     102                 :            : static sal_Unicode const aFzSongTi[] = { 0x65B9, 0x6B63, 0x5B8B, 0x4F53, 0, 0 };
     103                 :            : static sal_Unicode const aHYMyeongJoExtra[]         = { 'h', 'y', 0xACAC, 0xBA85, 0xC870, 0, 0 };
     104                 :            : static sal_Unicode const aHYSinMyeongJoMedium[]     = { 'h', 'y', 0xC2E0, 0xBA85, 0xC870, 0, 0 };
     105                 :            : static sal_Unicode const aHYGothicMedium[]          = { 'h', 'y', 0xC911, 0xACE0, 0xB515, 0, 0 };
     106                 :            : static sal_Unicode const aHYGraphicMedium[]         = { 'h', 'y', 0xADF8, 0xB798, 0xD53D, 'm', 0, 0 };
     107                 :            : static sal_Unicode const aHYGraphic[]               = { 'h', 'y', 0xADF8, 0xB798, 0xD53D, 0, 0 };
     108                 :            : static sal_Unicode const aNewGulim[]                = { 0xC0C8, 0xAD74, 0xB9BC, 0, 0 };
     109                 :            : static sal_Unicode const aSunGungseo[]              = { 0xC36C, 0xAD81, 0xC11C, 0, 0 };
     110                 :            : static sal_Unicode const aHYGungSoBold[]            = { 'h','y', 0xAD81, 0xC11C, 'b', 0, 0 };
     111                 :            : static sal_Unicode const aHYGungSo[]                 = { 'h','y', 0xAD81, 0xC11C, 0, 0 };
     112                 :            : static sal_Unicode const aSunHeadLine[]             = { 0xC36C, 0xD5E4, 0xB4DC, 0xB77C, 0xC778, 0, 0 };
     113                 :            : static sal_Unicode const aHYHeadLineMedium[]        = { 'h', 'y', 0xD5E4, 0xB4DC, 0xB77C, 0xC778, 'm', 0, 0 };
     114                 :            : static sal_Unicode const aHYHeadLine[]              = { 'h', 'y', 0xD5E4, 0xB4DC, 0xB77C, 0xC778, 0, 0 };
     115                 :            : static sal_Unicode const aYetR[]                    = { 0xD734, 0xBA3C, 0xC61B, 0xCCB4, 0, 0 };
     116                 :            : static sal_Unicode const aHYGothicExtra[]           = { 'h', 'y', 0xACAC, 0xACE0, 0xB515, 0, 0 };
     117                 :            : static sal_Unicode const aSunMokPan[]               = { 0xC36C, 0xBAA9, 0xD310, 0, 0 };
     118                 :            : static sal_Unicode const aSunYeopseo[]              = { 0xC36C, 0xC5FD, 0xC11C, 0, 0 };
     119                 :            : static sal_Unicode const aSunBaekSong[]              = { 0xC36C, 0xBC31, 0xC1A1, 0, 0 };
     120                 :            : static sal_Unicode const aHYPostLight[]             = { 'h', 'y', 0xC5FD, 0xC11C, 'l', 0, 0 };
     121                 :            : static sal_Unicode const aHYPost[]                  = { 'h', 'y', 0xC5FD, 0xC11C, 0, 0 };
     122                 :            : static sal_Unicode const aMagicR[]                  = { 0xD734, 0xBA3C, 0xB9E4, 0xC9C1, 0xCCB4, 0, 0 };
     123                 :            : static sal_Unicode const aSunCrystal[]              = { 0xC36C, 0xD06C, 0xB9AC, 0xC2A4, 0xD0C8, 0, 0 };
     124                 :            : static sal_Unicode const aSunSaemmul[]              = { 0xC36C, 0xC0D8, 0xBB3C, 0, 0 };
     125                 :            : static sal_Unicode const aHaansoftBatang[]          = { 0xD55C, 0xCEF4, 0xBC14, 0xD0D5, 0, 0 };
     126                 :            : static sal_Unicode const aHaansoftDotum[]           = { 0xD55C, 0xCEF4, 0xB3CB, 0xC6C0, 0, 0 };
     127                 :            : static sal_Unicode const aHyhaeseo[]                = { 0xD55C, 0xC591, 0xD574, 0xC11C, 0, 0 };
     128                 :            : static sal_Unicode const aMDSol[]                   = { 'm', 'd', 0xC194, 0xCCB4, 0, 0 };
     129                 :            : static sal_Unicode const aMDGaesung[]               = { 'm', 'd', 0xAC1C, 0xC131, 0xCCB4, 0, 0 };
     130                 :            : static sal_Unicode const aMDArt[]                   = { 'm', 'd', 0xC544, 0xD2B8, 0xCCB4, 0, 0 };
     131                 :            : static sal_Unicode const aMDAlong[]                 = { 'm', 'd', 0xC544, 0xB871, 0xCCB4, 0, 0 };
     132                 :            : static sal_Unicode const aMDEasop[]                 = { 'm', 'd', 0xC774, 0xC19D, 0xCCB4, 0, 0 };
     133                 :            : static sal_Unicode const aHYShortSamulMedium[]      = { 'h', 'y', 0xC595, 0xC740, 0xC0D8, 0xBB3C, 'm', 0 };
     134                 :            : static sal_Unicode const aHYShortSamul[]            = { 'h', 'y', 0xC595, 0xC740, 0xC0D8, 0xBB3C, 0 };
     135                 :            : static sal_Unicode const aHGGothicE[]               = { 'h','g', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'e', 0 };
     136                 :            : static sal_Unicode const aHGPGothicE[]              = { 'h','g','p', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'e', 0 };
     137                 :            : static sal_Unicode const aHGSGothicE[]              = { 'h','g','s', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'e', 0 };
     138                 :            : static sal_Unicode const aHGGothicM[]               = { 'h','g', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'm', 0 };
     139                 :            : static sal_Unicode const aHGPGothicM[]              = { 'h','g','p', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'm', 0 };
     140                 :            : static sal_Unicode const aHGSGothicM[]              = { 'h','g','s', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'm', 0 };
     141                 :            : static sal_Unicode const aHGGyoshotai[]             = { 'h','g', 0x884C, 0x66F8, 0x4F53, 0 };
     142                 :            : static sal_Unicode const aHGPGyoshotai[]            = { 'h','g','p', 0x884C, 0x66F8, 0x4F53, 0 };
     143                 :            : static sal_Unicode const aHGSGyoshotai[]            = { 'h','g','s', 0x884C, 0x66F8, 0x4F53, 0 };
     144                 :            : static sal_Unicode const aHGKyokashotai[]           = { 'h','g', 0x6559, 0x79D1, 0x66F8, 0x4F53, 0 };
     145                 :            : static sal_Unicode const aHGPKyokashotai[]          = { 'h','g','p', 0x6559, 0x79D1, 0x66F8, 0x4F53, 0 };
     146                 :            : static sal_Unicode const aHGSKyokashotai[]          = { 'h','g','s', 0x6559, 0x79D1, 0x66F8, 0x4F53, 0 };
     147                 :            : static sal_Unicode const aHGMinchoB[]               = { 'h','g', 0x660E, 0x671D, 'b', 0 };
     148                 :            : static sal_Unicode const aHGPMinchoB[]              = { 'h','g','p', 0x660E, 0x671D, 'b', 0 };
     149                 :            : static sal_Unicode const aHGSMinchoB[]              = { 'h','g','s', 0x660E, 0x671D, 'b', 0 };
     150                 :            : static sal_Unicode const aHGMinchoE[]               = { 'h','g', 0x660E, 0x671D, 'e', 0 };
     151                 :            : static sal_Unicode const aHGPMinchoE[]              = { 'h','g','p', 0x660E, 0x671D, 'e', 0 };
     152                 :            : static sal_Unicode const aHGSMinchoE[]              = { 'h','g','s', 0x660E, 0x671D, 'e', 0 };
     153                 :            : static sal_Unicode const aHGSoeiKakupoptai[]        = { 'h','g', 0x5275,0x82F1,0x89D2,0xFF8E,
     154                 :            :                             0xFF9F,0xFF6F,0xFF8C,0xFF9F,0x4F53,0};
     155                 :            : static sal_Unicode const aHGPSoeiKakupoptai[]       = { 'h','g', 'p', 0x5275,0x82F1,0x89D2,0xFF8E,
     156                 :            :                             0xFF9F,0xFF6F,0xFF8C,0xFF9F,0x4F53,0};
     157                 :            : static sal_Unicode const aHGSSoeiKakupoptai[]       = { 'h','g', 's', 0x5275,0x82F1,0x89D2,0xFF8E,
     158                 :            :                             0xFF9F,0xFF6F,0xFF8C,0xFF9F,0x4F53,0};
     159                 :            : static sal_Unicode const aHGSoeiPresenceEB[]        = { 'h','g', 0x5275,0x82F1,0xFF8C,0xFF9F,
     160                 :            :                             0xFF9A,0xFF7E,0xFF9E,0xFF9D,0xFF7D, 'e','b',0};
     161                 :            : static sal_Unicode const aHGPSoeiPresenceEB[]       = { 'h','g','p', 0x5275,0x82F1,0xFF8C,0xFF9F,
     162                 :            :                             0xFF9A,0xFF7E,0xFF9E,0xFF9D,0xFF7D, 'e','b',0};
     163                 :            : static sal_Unicode const aHGSSoeiPresenceEB[]       = { 'h','g','s', 0x5275,0x82F1,0xFF8C,0xFF9F,
     164                 :            :                             0xFF9A,0xFF7E,0xFF9E,0xFF9D,0xFF7D, 'e','b',0};
     165                 :            : static sal_Unicode const aHGSoeiKakugothicUB[]      = { 'h','g', 0x5275,0x82F1,0x89D2,0xFF7A,
     166                 :            :                             0xFF9E,0xFF7C,0xFF6F,0xFF78,'u','b',0};
     167                 :            : static sal_Unicode const aHGPSoeiKakugothicUB[]     = { 'h','g','p', 0x5275,0x82F1,0x89D2,0xFF7A,
     168                 :            :                             0xFF9E,0xFF7C,0xFF6F,0xFF78,'u','b',0};
     169                 :            : static sal_Unicode const aHGSSoeiKakugothicUB[]     = { 'h','g','s', 0x5275,0x82F1,0x89D2,0xFF7A,
     170                 :            :                             0xFF9E,0xFF7C,0xFF6F,0xFF78,'u','b',0};
     171                 :            : static sal_Unicode const aHGSeikaishotaiPRO[]       = { 'h','g', 0x6B63,0x6977,0x66F8,0x4F53, '-','p','r','o',0};
     172                 :            : static sal_Unicode const aHGMaruGothicMPRO[]        = { 'h','g', 0x4E38,0xFF7A,0xFF9E,0xFF7C,0xFF6F,0xFF78, '-','p','r','o',0};
     173                 :            : static sal_Unicode const aHiraginoMinchoPro[]       = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x660E, 0x671D, 'p','r','o',0};
     174                 :            : static sal_Unicode const aHiraginoMinchoProN[]      = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x660E, 0x671D, 'p','r','o','n',0};
     175                 :            : static sal_Unicode const aHiraginoKakuGothicPro[]   = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x89D2, 0x30B4, 'p','r','o',0};
     176                 :            : static sal_Unicode const aHiraginoKakuGothicProN[]  = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x89D2, 0x30B4, 'p','r','o','n',0};
     177                 :            : static sal_Unicode const aHiraginoMaruGothicPro[]   = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x4E38, 0x30B4, 'p','r','o',0};
     178                 :            : static sal_Unicode const aHiraginoMaruGothicProN[]  = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x4E38, 0x30B4, 'p','r','o','n',0};
     179                 :            : 
     180                 :            : static ImplLocalizedFontName aImplLocalizedNamesList[] =
     181                 :            : {
     182                 :            : {   "batang",               aBatang },
     183                 :            : {   "batangche",            aBatangChe },
     184                 :            : {   "gungshu",              aGungsuh },
     185                 :            : {   "gungshuche",           aGungsuhChe },
     186                 :            : {   "gulim",                aGulim },
     187                 :            : {   "gulimche",             aGulimChe },
     188                 :            : {   "dotum",                aDotum },
     189                 :            : {   "dotumche",             aDotumChe },
     190                 :            : {   "simsun",               aSimSun },
     191                 :            : {   "nsimsun",              aNSimSun },
     192                 :            : {   "simhei",               aSimHei },
     193                 :            : {   "simkai",               aSimKai },
     194                 :            : {   "zycjksun",             azycjkSun },
     195                 :            : {   "zycjkhei",             azycjkHei },
     196                 :            : {   "zycjkkai",             azycjkKai },
     197                 :            : {   "fzhei",                aFZHei },
     198                 :            : {   "fzkai",                aFZKai },
     199                 :            : {   "fzsong",               aFZSongYI },
     200                 :            : {   "fzshusong",            aFZShuSong },
     201                 :            : {   "fzfangsong",           aFZFangSong },
     202                 :            : {   "mhei",                 aMHei },
     203                 :            : {   "mkai",                 aMKai },
     204                 :            : {   "msong",                aMSong },
     205                 :            : {   "cfangsong",            aCFangSong },
     206                 :            : {   "mingliu",              aMingLiU },
     207                 :            : {   "pmingliu",             aPMingLiU },
     208                 :            : {   "hei",                  aHei },
     209                 :            : {   "kai",                  aKai },
     210                 :            : {   "ming",                 aMing },
     211                 :            : {   "msgothic",             aMSGothic },
     212                 :            : {   "mspgothic",            aMSPGothic },
     213                 :            : {   "msmincho",             aMSMincho },
     214                 :            : {   "mspmincho",            aMSPMincho },
     215                 :            : {   "microsoftjhenghei",    aMSJhengHei },
     216                 :            : {   "microsoftyahei",       aMSYaHei },
     217                 :            : {   "meiryo",               aMeiryo },
     218                 :            : {   "hgminchol",            aHGMinchoL },
     219                 :            : {   "hggothicb",            aHGGothicB },
     220                 :            : {   "hgpminchol",           aHGPMinchoL },
     221                 :            : {   "hgpgothicb",           aHGPGothicB },
     222                 :            : {   "hgmincholsun",         aHGMinchoLSun },
     223                 :            : {   "hggothicbsun",         aHGGothicBSun },
     224                 :            : {   "hgpmincholsun",        aHGPMinchoLSun },
     225                 :            : {   "hgpgothicbsun",        aHGPGothicBSun },
     226                 :            : {   "hgheiseimin",          aHGHeiseiMin },
     227                 :            : {   "ipamincho",            aIPAMincho },
     228                 :            : {   "ipapmincho",           aIPAPMincho },
     229                 :            : {   "ipagothic",            aIPAGothic },
     230                 :            : {   "ipapgothic",           aIPAPGothic },
     231                 :            : {   "ipauigothic",          aIPAUIGothic },
     232                 :            : {   "takaomincho",          aTakaoMincho },
     233                 :            : {   "takaopmincho",         aTakaoPMincho },
     234                 :            : {   "takaogothic",          aTakaoGothic },
     235                 :            : {   "takaopgothic",         aTakaoPGothic },
     236                 :            : {   "sazanamimincho",       aSazanamiMincho },
     237                 :            : {   "sazanamigothic",       aSazanamiGothic },
     238                 :            : {   "kochimincho",          aKochiMincho },
     239                 :            : {   "kochigothic",          aKochiGothic },
     240                 :            : {   "sundotum",             aSunDotum },
     241                 :            : {   "sungulim",             aSunGulim },
     242                 :            : {   "sunbatang",            aSunBatang },
     243                 :            : {   "baekmukdotum",         aBaekmukDotum },
     244                 :            : {   "baekmukgulim",         aBaekmukGulim },
     245                 :            : {   "baekmukbatang",        aBaekmukBatang },
     246                 :            : {   "fzheiti",              aFzHeiTiCN },
     247                 :            : {   "fzheiti",              aFzHeiTiTW },
     248                 :            : {   "fzkaiti",              aFzKaiTiCN },
     249                 :            : {   "fzkaitib",             aFzKaiTiTW },
     250                 :            : {   "fzmingtib",            aFzMingTi },
     251                 :            : {   "fzsongti",             aFzSongTi },
     252                 :            : {   "hymyeongjoextra",      aHYMyeongJoExtra },
     253                 :            : {   "hysinmyeongjomedium",  aHYSinMyeongJoMedium },
     254                 :            : {   "hygothicmedium",       aHYGothicMedium },
     255                 :            : {   "hygraphicmedium",      aHYGraphicMedium },
     256                 :            : {   "hygraphic",            aHYGraphic },
     257                 :            : {   "newgulim",             aNewGulim },
     258                 :            : {   "sungungseo",           aSunGungseo },
     259                 :            : {   "hygungsobold",         aHYGungSoBold },
     260                 :            : {   "hygungso",             aHYGungSo },
     261                 :            : {   "sunheadline",          aSunHeadLine },
     262                 :            : {   "hyheadlinemedium",     aHYHeadLineMedium },
     263                 :            : {   "hyheadline",           aHYHeadLine },
     264                 :            : {   "yetr",                 aYetR },
     265                 :            : {   "hygothicextra",        aHYGothicExtra },
     266                 :            : {   "sunmokpan",            aSunMokPan },
     267                 :            : {   "sunyeopseo",           aSunYeopseo },
     268                 :            : {   "sunbaeksong",          aSunBaekSong },
     269                 :            : {   "hypostlight",          aHYPostLight },
     270                 :            : {   "hypost",               aHYPost },
     271                 :            : {   "magicr",               aMagicR },
     272                 :            : {   "suncrystal",           aSunCrystal },
     273                 :            : {   "sunsaemmul",           aSunSaemmul },
     274                 :            : {   "hyshortsamulmedium",   aHYShortSamulMedium },
     275                 :            : {   "hyshortsamul",         aHYShortSamul },
     276                 :            : {   "haansoftbatang",       aHaansoftBatang },
     277                 :            : {   "haansoftdotum",        aHaansoftDotum },
     278                 :            : {   "hyhaeseo",             aHyhaeseo },
     279                 :            : {   "mdsol",                aMDSol },
     280                 :            : {   "mdgaesung",            aMDGaesung },
     281                 :            : {   "mdart",                aMDArt },
     282                 :            : {   "mdalong",              aMDAlong },
     283                 :            : {   "mdeasop",              aMDEasop },
     284                 :            : {   "hggothice",            aHGGothicE },
     285                 :            : {   "hgpgothice",           aHGPGothicE },
     286                 :            : {   "hgpothice",            aHGSGothicE },
     287                 :            : {   "hggothicm",            aHGGothicM },
     288                 :            : {   "hgpgothicm",           aHGPGothicM },
     289                 :            : {   "hgpgothicm",           aHGSGothicM },
     290                 :            : {   "hggyoshotai",          aHGGyoshotai },
     291                 :            : {   "hgpgyoshotai",         aHGPGyoshotai },
     292                 :            : {   "hgsgyoshotai",         aHGSGyoshotai },
     293                 :            : {   "hgkyokashotai",        aHGKyokashotai },
     294                 :            : {   "hgpkyokashotai",       aHGPKyokashotai },
     295                 :            : {   "hgskyokashotai",       aHGSKyokashotai },
     296                 :            : {   "hgminchob",            aHGMinchoB },
     297                 :            : {   "hgpminchob",           aHGPMinchoB },
     298                 :            : {   "hgsminchob",           aHGSMinchoB },
     299                 :            : {   "hgminchoe",            aHGMinchoE },
     300                 :            : {   "hgpminchoe",           aHGPMinchoE },
     301                 :            : {   "hgsminchoe",           aHGSMinchoE },
     302                 :            : {   "hgsoeikakupoptai",     aHGSoeiKakupoptai },
     303                 :            : {   "hgpsoeikakupopta",     aHGPSoeiKakupoptai },
     304                 :            : {   "hgssoeikakupopta",     aHGSSoeiKakupoptai },
     305                 :            : {   "hgsoeipresenceeb",     aHGSoeiPresenceEB },
     306                 :            : {   "hgpsoeipresenceeb",    aHGPSoeiPresenceEB },
     307                 :            : {   "hgssoeipresenceeb",    aHGSSoeiPresenceEB },
     308                 :            : {   "hgsoeikakugothicub",   aHGSoeiKakugothicUB },
     309                 :            : {   "hgpsoeikakugothicub",  aHGPSoeiKakugothicUB },
     310                 :            : {   "hgssoeikakugothicub",  aHGSSoeiKakugothicUB },
     311                 :            : {   "hgseikaishotaipro",    aHGSeikaishotaiPRO },
     312                 :            : {   "hgmarugothicmpro",     aHGMaruGothicMPRO },
     313                 :            : {   "hiraginominchopro",    aHiraginoMinchoPro },
     314                 :            : {   "hiraginominchopron",   aHiraginoMinchoProN },
     315                 :            : {   "hiraginokakugothicpro", aHiraginoKakuGothicPro },
     316                 :            : {   "hiraginokakugothicpron", aHiraginoKakuGothicProN },
     317                 :            : {   "hiraginomarugothicpro", aHiraginoMaruGothicPro },
     318                 :            : {   "hiraginomarugothicpron", aHiraginoMaruGothicProN },
     319                 :            : {   NULL,                   NULL },
     320                 :            : };
     321                 :            : 
     322                 :            : // -----------------------------------------------------------------------
     323                 :            : 
     324                 :     778242 : void GetEnglishSearchFontName( String& rName )
     325                 :            : {
     326                 :     778242 :     bool        bNeedTranslation = false;
     327                 :     778242 :     xub_StrLen  nLen = rName.Len();
     328                 :            : 
     329                 :            :     // Remove trailing whitespaces
     330                 :     778242 :     xub_StrLen i = nLen;
     331 [ +  + ][ -  + ]:     778242 :     while ( i && (rName.GetChar( i-1 ) < 32) )
                 [ -  + ]
     332                 :          0 :         i--;
     333         [ -  + ]:     778242 :     if ( i != nLen )
     334                 :          0 :         rName.Erase( i );
     335                 :            : 
     336                 :            :     // Remove Script at the end
     337                 :            :     // Scriptname must be the last part of the fontname and
     338                 :            :     // looks like "fontname (scriptname)". So there can only be a
     339                 :            :     // script name at the and of the fontname, when the last char is ')'
     340 [ +  + ][ -  + ]:     778242 :     if ( (nLen >= 3) && rName.GetChar( nLen-1 ) == ')' )
                 [ -  + ]
     341                 :            :     {
     342                 :          0 :         int nOpen = 1;
     343                 :          0 :         xub_StrLen nTempLen = nLen-2;
     344         [ #  # ]:          0 :         while ( nTempLen )
     345                 :            :         {
     346         [ #  # ]:          0 :             if ( rName.GetChar( nTempLen ) == '(' )
     347                 :            :             {
     348                 :          0 :                 nOpen--;
     349         [ #  # ]:          0 :                 if ( !nOpen )
     350                 :            :                 {
     351                 :            :                     // Remove Space at the end
     352 [ #  # ][ #  # ]:          0 :                     if ( nTempLen && (rName.GetChar( nTempLen-1 ) == ' ') )
                 [ #  # ]
     353                 :          0 :                         nTempLen--;
     354                 :          0 :                     rName.Erase( nTempLen );
     355                 :          0 :                     nLen = nTempLen;
     356                 :          0 :                     break;
     357                 :            :                 }
     358                 :            :             }
     359         [ #  # ]:          0 :             if ( rName.GetChar( nTempLen ) == ')' )
     360                 :          0 :                 nOpen++;
     361                 :          0 :             nTempLen--;
     362                 :            :         }
     363                 :            :     }
     364                 :            : 
     365                 :            :     // remove all whitespaces and converts to lower case ASCII
     366                 :            :     // TODO: better transliteration to ASCII e.g. all digits
     367                 :     778242 :     i = 0;
     368         [ +  + ]:   11126931 :     while ( i < nLen )
     369                 :            :     {
     370                 :   10348689 :         sal_Unicode c = rName.GetChar( i );
     371         [ +  + ]:   10348689 :         if ( c > 127 )
     372                 :            :         {
     373                 :            :             // Translate to Lowercase-ASCII
     374                 :            :             // FullWidth-ASCII to half ASCII
     375 [ -  + ][ #  # ]:     123750 :             if ( (c >= 0xFF00) && (c <= 0xFF5E) )
     376                 :            :             {
     377                 :          0 :                 c -= 0xFF00-0x0020;
     378                 :            :                 // Upper to Lower
     379 [ #  # ][ #  # ]:          0 :                 if ( (c >= 'A') && (c <= 'Z') )
     380                 :          0 :                     c += 'a' - 'A';
     381                 :          0 :                 rName.SetChar( i, c );
     382                 :            :             }
     383                 :            :             else
     384                 :            :             {
     385                 :            :                 // Only Fontnames with None-Ascii-Characters must be translated
     386                 :     123750 :                 bNeedTranslation = true;
     387                 :            :             }
     388                 :            :         }
     389                 :            :         // not lowercase Ascii
     390 [ +  + ][ -  + ]:   10224939 :         else if ( !((c >= 'a') && (c <= 'z')) )
     391                 :            :         {
     392                 :            :             // To Lowercase-Ascii
     393 [ +  + ][ +  - ]:    2658252 :             if ( (c >= 'A') && (c <= 'Z') )
     394                 :            :             {
     395                 :    1868310 :                 c += 'a' - 'A';
     396                 :    1868310 :                 rName.SetChar( i, c );
     397                 :            :             }
     398 [ +  + ][ +  + ]:     789942 :             else if( ((c < '0') || (c > '9')) && (c != ';') ) // not 0-9 or semicolon
                 [ +  + ]
     399                 :            :             {
     400                 :            :                 // Remove white spaces and special characters
     401                 :     777252 :                 rName.Erase( i, 1 );
     402                 :     777252 :                 nLen--;
     403                 :     777252 :                 continue;
     404                 :            :             }
     405                 :            :         }
     406                 :            : 
     407                 :    9571437 :         i++;
     408                 :            :     }
     409                 :            : 
     410                 :            :     // translate normalized localized name to its normalized English ASCII name
     411         [ +  + ]:     778242 :     if( bNeedTranslation )
     412                 :            :     {
     413                 :            :         typedef boost::unordered_map<const rtl::OUString, const char*, FontNameHash> FontNameDictionary;
     414 [ +  + ][ +  - ]:      30948 :         static FontNameDictionary aDictionary( SAL_N_ELEMENTS(aImplLocalizedNamesList) );
         [ +  - ][ #  # ]
     415                 :            :         // the font name dictionary needs to be intialized once
     416         [ +  + ]:      30948 :         if( aDictionary.empty() )
     417                 :            :         {
     418                 :            :             // TODO: check if all dictionary entries are already normalized?
     419                 :        129 :             const ImplLocalizedFontName* pList = aImplLocalizedNamesList;
     420         [ +  + ]:      17802 :             for(; pList->mpEnglishName; ++pList )
     421         [ +  - ]:      17673 :                 aDictionary[ pList->mpLocalizedNames ] = pList->mpEnglishName;
     422                 :            :         }
     423                 :            : 
     424 [ +  - ][ +  - ]:      30948 :         FontNameDictionary::const_iterator it = aDictionary.find( rName );
     425 [ +  - ][ +  - ]:      30948 :         if( it != aDictionary.end() )
     426 [ +  - ][ +  - ]:      30948 :             rName.AssignAscii( it->second );
     427                 :            :     }
     428                 :     778242 : }
     429                 :            : 
     430                 :            : // -----------------------------------------------------------------------
     431                 :            : 
     432                 :     174267 : String GetNextFontToken( const String& rTokenStr, xub_StrLen& rIndex )
     433                 :            : {
     434                 :            :     // check for valid start index
     435                 :     174267 :     int nStringLen = rTokenStr.Len();
     436         [ +  + ]:     174267 :     if( rIndex >= nStringLen )
     437                 :            :     {
     438                 :         90 :         rIndex = STRING_NOTFOUND;
     439                 :         90 :         return String();
     440                 :            :     }
     441                 :            : 
     442                 :            :     // find the next token delimiter and return the token substring
     443                 :     174177 :     const sal_Unicode* pStr = rTokenStr.GetBuffer() + rIndex;
     444                 :     174177 :     const sal_Unicode* pEnd = rTokenStr.GetBuffer() + nStringLen;
     445         [ +  + ]:    2454264 :     for(; pStr < pEnd; ++pStr )
     446 [ +  + ][ -  + ]:    2309840 :         if( (*pStr == ';') || (*pStr == ',') )
     447                 :      29753 :             break;
     448                 :            : 
     449                 :     174177 :     xub_StrLen nTokenStart = rIndex;
     450                 :            :     xub_StrLen nTokenLen;
     451         [ +  + ]:     174177 :     if( pStr < pEnd )
     452                 :            :     {
     453                 :      29753 :         rIndex = sal::static_int_cast<xub_StrLen>(pStr - rTokenStr.GetBuffer());
     454                 :      29753 :         nTokenLen = rIndex - nTokenStart;
     455                 :      29753 :         ++rIndex; // skip over token separator
     456                 :            :     }
     457                 :            :     else
     458                 :            :     {
     459                 :            :         // no token delimiter found => handle last token
     460                 :     144424 :         rIndex = STRING_NOTFOUND;
     461                 :     144424 :         nTokenLen = STRING_LEN;
     462                 :            : 
     463                 :            :         // optimize if the token string consists of just one token
     464         [ +  - ]:     144424 :         if( !nTokenStart )
     465                 :     144424 :             return rTokenStr;
     466                 :            :     }
     467                 :            : 
     468                 :     174267 :     return String( rTokenStr, nTokenStart, nTokenLen );
     469                 :            : }
     470                 :            : 
     471                 :            : // =======================================================================
     472                 :            : 
     473                 :        885 : static bool ImplIsFontToken( const String& rName, const String& rToken )
     474                 :            : {
     475         [ +  - ]:        885 :     String      aTempName;
     476                 :        885 :     xub_StrLen  nIndex = 0;
     477         [ -  + ]:        885 :     do
     478                 :            :     {
     479 [ +  - ][ +  - ]:        885 :         aTempName = GetNextFontToken( rName, nIndex );
                 [ +  - ]
     480 [ +  - ][ -  + ]:        885 :         if ( rToken == aTempName )
     481                 :          0 :             return true;
     482                 :            :     }
     483                 :            :     while ( nIndex != STRING_NOTFOUND );
     484                 :            : 
     485         [ +  - ]:        885 :     return false;
     486                 :            : }
     487                 :            : 
     488                 :            : // -----------------------------------------------------------------------
     489                 :            : 
     490                 :        885 : static void ImplAppendFontToken( String& rName, const String& rNewToken )
     491                 :            : {
     492         [ -  + ]:        885 :     if ( rName.Len() )
     493                 :            :     {
     494                 :          0 :         rName.Append( ';' );
     495                 :          0 :         rName.Append( rNewToken );
     496                 :            :     }
     497                 :            :     else
     498                 :        885 :         rName = rNewToken;
     499                 :        885 : }
     500                 :            : 
     501                 :          0 : void AddTokenFontName( String& rName, const String& rNewToken )
     502                 :            : {
     503         [ #  # ]:          0 :     if ( !ImplIsFontToken( rName, rNewToken ) )
     504                 :          0 :         ImplAppendFontToken( rName, rNewToken );
     505                 :          0 : }
     506                 :            : 
     507                 :            : // =======================================================================
     508                 :            : 
     509                 :       2451 : String GetSubsFontName( const String& rName, sal_uLong nFlags )
     510                 :            : {
     511         [ +  - ]:       2451 :     String aName;
     512                 :            : 
     513                 :       2451 :     xub_StrLen nIndex = 0;
     514         [ +  - ]:       2451 :     String aOrgName = GetNextFontToken( rName, nIndex );
     515         [ +  - ]:       2451 :     GetEnglishSearchFontName( aOrgName );
     516                 :            : 
     517                 :            :     // #93662# do not try to replace StarSymbol with MS only font
     518 [ +  - ][ +  - ]:       7353 :     if( nFlags == (SUBSFONT_MS|SUBSFONT_ONLYONE)
         [ -  + ][ +  - ]
     519         [ +  - ]:       2451 :     &&  ( aOrgName.EqualsAscii( "starsymbol" )
     520         [ +  - ]:       2451 :       ||  aOrgName.EqualsAscii( "opensymbol" ) ) )
     521                 :            :         return aName;
     522                 :            : 
     523 [ +  - ][ +  - ]:       2451 :     const utl::FontNameAttr* pAttr = utl::FontSubstConfiguration::get().getSubstInfo( aOrgName );
                 [ +  - ]
     524         [ +  + ]:       2451 :     if ( pAttr )
     525                 :            :     {
     526         [ +  + ]:       5466 :         for( int i = 0; i < 3; i++ )
     527                 :            :         {
     528                 :       3657 :             const ::std::vector< String >* pVector = NULL;
     529   [ +  +  +  - ]:       3657 :             switch( i )
     530                 :            :             {
     531                 :            :                 case 0:
     532 [ +  - ][ +  + ]:       1809 :                     if( nFlags & SUBSFONT_MS  &&  pAttr->MSSubstitutions.size() )
                 [ +  + ]
     533                 :        885 :                         pVector = &pAttr->MSSubstitutions;
     534                 :       1809 :                     break;
     535                 :            :                 case 1:
     536 [ -  + ][ #  # ]:        924 :                     if( nFlags & SUBSFONT_PS  &&  pAttr->PSSubstitutions.size() )
                 [ -  + ]
     537                 :          0 :                         pVector = &pAttr->PSSubstitutions;
     538                 :        924 :                     break;
     539                 :            :                 case 2:
     540 [ -  + ][ #  # ]:        924 :                     if( nFlags & SUBSFONT_HTML  &&  pAttr->HTMLSubstitutions.size() )
                 [ -  + ]
     541                 :          0 :                         pVector = &pAttr->HTMLSubstitutions;
     542                 :        924 :                     break;
     543                 :            :             }
     544         [ +  + ]:       3657 :             if( ! pVector )
     545                 :       2772 :                 continue;
     546 [ #  # ][ +  - ]:       1770 :             for( ::std::vector< String >::const_iterator it = pVector->begin(); it != pVector->end(); ++it )
                 [ +  - ]
     547 [ +  - ][ +  - ]:        885 :                 if( ! ImplIsFontToken( rName, *it ) )
                 [ +  - ]
     548                 :            :                 {
     549 [ +  - ][ +  - ]:        885 :                     ImplAppendFontToken( aName, *it );
     550         [ +  - ]:        885 :                     if( nFlags & SUBSFONT_ONLYONE )
     551                 :            :                     {
     552                 :        885 :                         i = 4;
     553                 :        885 :                         break;
     554                 :            :                     }
     555                 :            :                 }
     556                 :            :         }
     557                 :            :     }
     558                 :            : 
     559         [ +  - ]:       2451 :     return aName;
     560                 :            : }
     561                 :            : 
     562                 :            : // -----------------------------------------------------------------------
     563                 :            : 
     564                 :            : // TODO: use a more generic String hash
     565                 :    2484639 : int FontNameHash::operator()( const String& rStr ) const
     566                 :            : {
     567                 :            :     // this simple hash just has to be good enough for font names
     568                 :    2484639 :     int nHash = 0;
     569                 :    2484639 :     const int nLen = rStr.Len();
     570                 :    2484639 :     const sal_Unicode* p = rStr.GetBuffer();
     571   [ +  +  +  +  :    2484639 :     switch( nLen )
                      + ]
     572                 :            :     {
     573                 :    2470205 :         default: nHash = (p[0]<<16) - (p[1]<<8) + p[2];
     574                 :    2470205 :                  nHash += nLen;
     575                 :    2470205 :                  p += nLen - 3;
     576                 :            :                  // fall through
     577                 :    2473658 :         case 3:  nHash += (p[2]<<16);   // fall through
     578                 :    2474750 :         case 2:  nHash += (p[1]<<8);    // fall through
     579                 :    2475008 :         case 1:  nHash += p[0];         // fall through
     580                 :    2484639 :         case 0:  break;
     581                 :            :     };
     582                 :            : 
     583                 :    2484639 :     return nHash;
     584                 :            : }
     585                 :            : 
     586                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10