Fix typo
[LibreOffice.git] / vcl / source / fontsubset / fontsubset.cxx
blob0fab8bfbf087dab58dff5f3ece8fb37528e48cb5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include <osl/diagnose.h>
22 #include <sal/log.hxx>
24 #include <fontsubset.hxx>
25 #include <sft.hxx>
27 FontSubsetInfo::FontSubsetInfo()
28 : m_nAscent( 0)
29 , m_nDescent( 0)
30 , m_nCapHeight( 0)
31 , m_nFontType( FontType::NO_FONT)
32 , m_bFilled(false)
33 , mpInFontBytes( nullptr)
34 , mnInByteLength( 0)
35 , meInFontType( FontType::NO_FONT)
36 , mnReqFontTypeMask( FontType::NO_FONT )
37 , mpOutFile(nullptr)
38 , mpReqGlyphIds(nullptr)
39 , mpReqEncodedIds(nullptr)
40 , mnReqGlyphCount(0)
44 FontSubsetInfo::~FontSubsetInfo()
48 // prepare subsetting for fonts where the input font file is mapped
49 void FontSubsetInfo::LoadFont(
50 FontType eInFontType,
51 const unsigned char* pInFontBytes, int nInByteLength)
53 meInFontType = eInFontType;
54 mpInFontBytes = pInFontBytes;
55 mnInByteLength = nInByteLength;
58 bool FontSubsetInfo::CreateFontSubset(
59 FontType nReqFontTypeMask,
60 SvStream* pOutFile,
61 const sal_GlyphId* pReqGlyphIds, const sal_uInt8* pReqEncodedIds, int nReqGlyphCount)
63 // prepare request details needed by all underlying subsetters
64 mnReqFontTypeMask = nReqFontTypeMask;
65 mpOutFile = pOutFile;
66 mpReqGlyphIds = pReqGlyphIds;
67 mpReqEncodedIds = pReqEncodedIds;
68 mnReqGlyphCount = nReqGlyphCount;
69 maReqFontName = m_aPSName.toUtf8();
71 // TODO: move the glyphid/encid/notdef reshuffling from the callers to here
73 // dispatch to underlying subsetters
74 bool bOK = false;
76 // TODO: better match available input-type to possible subset-types
77 switch( meInFontType) {
78 case FontType::CFF_FONT:
79 bOK = CreateFontSubsetFromCff();
80 break;
81 default:
82 OSL_FAIL( "unhandled type in CreateFontSubset()");
83 break;
86 return bOK;
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */