1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <stdio.h>
#ifdef SOLARIS
#include <strings.h>
#else
#include <string.h>
#endif
#include <fontmap.hxx>
// #i42367# prevent MS compiler from using system locale for parsing
#ifdef _MSC_VER
#pragma setlocale("C")
#endif
struct FontEntry
{
const char *familyname;
int key;
double ratio;
};
/**
* ratio\xb4\xc2 \xc7\xd1\xb1\xdb 70%, \xbc\xfd\xc0\xda 10% \xbf\xb5\xb9\xae 20%\xc0\xc7 \xba\xf1\xc0\xb2\xb7\xce \xb1\xb8\xbc\xba\xb5\xc7\xbe\xfa\xb4\xd9\xb4\xc2 \xb0\xa1\xc1\xa4\xc7\xcf\xbf\xa1 \xc1\xa4\xc7\xd8\xc1\xf8\xb4\xd9.
*/
const struct FontEntry FontMapTab[] =
{
{"\xb8\xed\xc1\xb6",0, 0.97},
{"\xb0\xed\xb5\xf1",1, 0.97},
{"\xbb\xf9\xb9\xb0",1, 0.97},
{"\xc7\xca\xb1\xe2",0, 0.97},
{"\xbd\xc3\xbd\xba\xc5\xdb",1, 0.84},
{"\xbd\xc3\xbd\xba\xc5\xdb \xbe\xe0\xc0\xda",1, 0.84},
{"\xbd\xc3\xbd\xba\xc5\xdb \xb0\xa3\xc0\xda",1, 0.84},
{"HY\xb5\xd5\xb1\xd9 \xb0\xed\xb5\xf1",2, 0.97},
{"\xbf\xbe\xc7\xd1\xb1\xdb",0, 0.97},
{"\xb0\xa1\xb4\xc2\xb0\xf8\xc7\xd1",0, 0.72},
{"\xc1\xdf\xb0\xa3\xb0\xf8\xc7\xd1",0, 0.72},
{"\xb1\xbd\xc0\xba\xb0\xf8\xc7\xd1",0, 0.72},
{"\xb0\xa1\xb4\xc2\xc7\xd1",0, 0.72},
{"\xc1\xdf\xb0\xa3\xc7\xd1",0, 0.72},
{"\xb1\xbd\xc0\xba\xc7\xd1",0, 0.72},
{"\xc8\xde\xb8\xd5\xb8\xed\xc1\xb6",0, 0.97},
{"\xc8\xde\xb8\xd5\xb0\xed\xb5\xf1",1, 0.97},
{"\xb0\xa1\xb4\xc2\xbe\xc8\xbb\xf3\xbc\xf6\xc3\xbc",0, 0.55},
{"\xc1\xdf\xb0\xa3\xbe\xc8\xbb\xf3\xbc\xf6\xc3\xbc",0, 0.637},
{"\xb1\xbd\xc0\xba\xbe\xc8\xbb\xf3\xbc\xf6\xc3\xbc",0, 0.63},
{"\xc8\xde\xb8\xd5\xb0\xa1\xb4\xc2\xbb\xf9\xc3\xbc",0, 0.666},
{"\xc8\xde\xb8\xd5\xc1\xdf\xb0\xa3\xbb\xf9\xc3\xbc",0, 0.685},
{"\xc8\xde\xb8\xd5\xb1\xbd\xc0\xba\xbb\xf9\xc3\xbc",0, 0.727},
{"\xc8\xde\xb8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\xbd\xc5\xb9\xae\xb8\xed\xc1\xb6",0, 0.97},
{"\xbd\xc5\xb8\xed \xbc\xf8\xb8\xed\xc1\xb6",0, 0.97},
{"\xbd\xc5\xb8\xed \xbc\xbc\xb0\xed\xb5\xf1",1, 0.97},
{"\xbd\xc5\xb8\xed \xc1\xdf\xb0\xed\xb5\xf1",1, 0.97},
{"\xbd\xc5\xb8\xed \xc5\xc2\xb0\xed\xb5\xf1",1, 0.97},
{"\xbd\xc5\xb8\xed \xb0\xdf\xb0\xed\xb5\xf1",1, 0.97},
{"\xbd\xc5\xb8\xed \xbc\xbc\xb3\xaa\xb7\xe7",2, 0.97},
{"\xbd\xc5\xb8\xed \xb5\xf0\xb3\xaa\xb7\xe7",2, 0.97},
{"\xbd\xc5\xb8\xed \xbd\xc5\xb1\xd7\xb7\xa1\xc7\xc8",2, 0.97},
{"\xbd\xc5\xb8\xed \xc5\xc2\xb1\xd7\xb7\xa1\xc7\xc8",2, 0.97},
{"\xbd\xc5\xb8\xed \xb1\xc3\xbc\xad",3, 0.97}
};
#ifndef WIN32
#if defined(LINUX)
const char* RepFontTab[] =
{
"\xb9\xe9\xb9\xac \xb9\xd9\xc5\xc1", /* 0 */
"\xb9\xe9\xb9\xac \xb5\xb8\xbf\xf2", /* 1 */
"\xb9\xe9\xb9\xac \xb1\xbc\xb8\xb2", /* 2 */
"\xb9\xe9\xb9\xac \xc7\xec\xb5\xe5\xb6\xf3\xc0\xce" /* 3 */
};
#else
const char* RepFontTab[] =
{
"Batang", /* 0 */
"Dotum", /* 1 */
"Gulim", /* 2 */
"Gungso" /* 3 */
};
#endif
#else
const char* RepFontTab[] =
{
"\xb9\xd9\xc5\xc1", /* 0 */
"\xb5\xb8\xbf\xf2", /* 1 */
"\xb1\xbc\xb8\xb2", /* 2 */
"\xb1\xc3\xbc\xad" /* 3 */
};
#endif
int getRepFamilyName(const char* orig, char *buf, double &ratio)
{
int i;
int size = sizeof(FontMapTab)/sizeof(FontEntry);
for( i = 0 ; i < size ; i++)
{
if( !strcmp(orig, FontMapTab[i].familyname) ){
ratio = FontMapTab[i].ratio;
return strlen( strcpy(buf,RepFontTab[FontMapTab[i].key]) );
}
}
ratio = FontMapTab[0].ratio;
return strlen( strcpy(buf, RepFontTab[0] ) );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|