File: gr_Abi_ComputerModernShaper.cpp

package info (click to toggle)
abiword 3.0.8%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 64,532 kB
  • sloc: cpp: 477,427; ansic: 16,754; makefile: 5,785; xml: 4,014; yacc: 1,818; lex: 1,104; perl: 812; python: 413; php: 183; sh: 169
file content (65 lines) | stat: -rw-r--r-- 2,180 bytes parent folder | download | duplicates (7)
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
/* AbiWord
 * Copyright (C) 2004 Luca Padovani <lpadovan@cs.unibo.it>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 */

#include <stdio.h>
#include "ut_types.h" // for UT_UCS4Char
#include "gr_Graphics.h"

#include <MathView/AbstractLogger.hh>
#include <MathView/Configuration.hh>

#include "gr_Abi_CharArea.h"
#include "gr_Abi_ComputerModernShaper.h"

GR_Abi_ComputerModernShaper::GR_Abi_ComputerModernShaper(const SmartPtr<AbstractLogger>& l,
							 const SmartPtr<Configuration>& conf)
  : ComputerModernShaper(l, conf)
{ }

GR_Abi_ComputerModernShaper::~GR_Abi_ComputerModernShaper()
{ }


SmartPtr<GR_Abi_ComputerModernShaper>
GR_Abi_ComputerModernShaper::create(const SmartPtr<AbstractLogger>& l,
				    const SmartPtr<Configuration>& conf)
{ return new GR_Abi_ComputerModernShaper(l, conf); }

AreaRef
GR_Abi_ComputerModernShaper::getGlyphArea(ComputerModernFamily::FontNameId fontName,
					  ComputerModernFamily::FontSizeId designSize,
					  UChar8 index, int size) const
{
  static char fontSize[128];
  sprintf(fontSize, "%dpt", size);

  static char fontFamily[128];
  sprintf(fontFamily, "%s", getFamily()->nameOfFont(fontName, designSize).c_str());

  GR_Font* font = m_pGraphics->findFont(fontFamily, "normal", "", "normal", "", fontSize, "");
  UT_ASSERT(font);

  return GR_Abi_CharArea::create(getGraphics(), font, size, toTTFGlyphIndex(getFamily()->encIdOfFontNameId(fontName), index));
}

void
GR_Abi_ComputerModernShaper::setGraphics(GR_Graphics* pGr)
{
  m_pGraphics = pGr;
}