| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. | 2 * Copyright (c) 2006, 2007, 2008, Google Inc. All rights reserved. |
| 3 * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com | |
| 4 * Copyright (C) 2007 Holger Hans Peter Freyther | |
| 5 * Copyright (C) 2007 Pioneer Research Center USA, Inc. | |
| 6 * Copyright (C) 2010, 2011 Brent Fulgham <bfulgham@webkit.org> | |
| 7 * | 3 * |
| 8 * This library is free software; you can redistribute it and/or | 4 * Redistribution and use in source and binary forms, with or without |
| 9 * modify it under the terms of the GNU Library General Public | 5 * modification, are permitted provided that the following conditions are |
| 10 * License as published by the Free Software Foundation; either | 6 * met: |
| 11 * version 2 of the License, or (at your option) any later version. | |
| 12 * | 7 * |
| 13 * This library is distributed in the hope that it will be useful, | 8 * * Redistributions of source code must retain the above copyright |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 * notice, this list of conditions and the following disclaimer. |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 10 * * Redistributions in binary form must reproduce the above |
| 16 * Library General Public License for more details. | 11 * copyright notice, this list of conditions and the following disclaimer |
| 12 * in the documentation and/or other materials provided with the |
| 13 * distribution. |
| 14 * * Neither the name of Google Inc. nor the names of its |
| 15 * contributors may be used to endorse or promote products derived from |
| 16 * this software without specific prior written permission. |
| 17 * | 17 * |
| 18 * You should have received a copy of the GNU Library General Public License | 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 * along with this library; see the file COPYING.LIB. If not, write to | 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 * Boston, MA 02110-1301, USA. | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 23 */ | 29 */ |
| 24 | 30 |
| 25 // FIXME: This is temporary until mac switch to using FontPlatformDataHarfBuzz.h
and we merge it with this file. | 31 #ifndef FontPlatformDataHarfBuzz_h |
| 26 #include "platform/fonts/harfbuzz/FontPlatformDataHarfBuzz.h" | 32 #define FontPlatformDataHarfBuzz_h |
| 33 |
| 34 #include "SkPaint.h" |
| 35 #include "platform/SharedBuffer.h" |
| 36 #include "platform/fonts/FontDescription.h" |
| 37 #include "platform/fonts/FontOrientation.h" |
| 38 #include "platform/fonts/FontRenderStyle.h" |
| 39 #include "platform/fonts/opentype/OpenTypeVerticalData.h" |
| 40 #include "wtf/Forward.h" |
| 41 #include "wtf/HashTableDeletedValueType.h" |
| 42 #include "wtf/RefPtr.h" |
| 43 #include "wtf/text/CString.h" |
| 44 #include "wtf/text/StringImpl.h" |
| 45 |
| 46 class SkTypeface; |
| 47 typedef uint32_t SkFontID; |
| 48 |
| 49 namespace blink { |
| 50 |
| 51 class GraphicsContext; |
| 52 class HarfBuzzFace; |
| 53 |
| 54 class PLATFORM_EXPORT FontPlatformData { |
| 55 public: |
| 56 // Used for deleted values in the font cache's hash tables. The hash table |
| 57 // will create us with this structure, and it will compare other values |
| 58 // to this "Deleted" one. It expects the Deleted one to be differentiable |
| 59 // from the 0 one (created with the empty constructor), so we can't just |
| 60 // set everything to 0. |
| 61 FontPlatformData(WTF::HashTableDeletedValueType); |
| 62 FontPlatformData(); |
| 63 FontPlatformData(float textSize, bool syntheticBold, bool syntheticItalic); |
| 64 FontPlatformData(const FontPlatformData&); |
| 65 FontPlatformData(PassRefPtr<SkTypeface>, const char* name, float textSize, b
ool syntheticBold, bool syntheticItalic, FontOrientation = Horizontal, bool subp
ixelTextPosition = defaultUseSubpixelPositioning()); |
| 66 FontPlatformData(const FontPlatformData& src, float textSize); |
| 67 ~FontPlatformData(); |
| 68 |
| 69 String fontFamilyName() const; |
| 70 float size() const { return m_textSize; } |
| 71 bool isFixedPitch() const; |
| 72 |
| 73 SkTypeface* typeface() const { return m_typeface.get(); } |
| 74 HarfBuzzFace* harfBuzzFace() const; |
| 75 SkFontID uniqueID() const; |
| 76 unsigned hash() const; |
| 77 |
| 78 FontOrientation orientation() const { return m_orientation; } |
| 79 void setOrientation(FontOrientation orientation) { m_orientation = orientati
on; } |
| 80 void setSyntheticBold(bool syntheticBold) { m_syntheticBold = syntheticBold;
} |
| 81 void setSyntheticItalic(bool syntheticItalic) { m_syntheticItalic = syntheti
cItalic; } |
| 82 bool operator==(const FontPlatformData&) const; |
| 83 FontPlatformData& operator=(const FontPlatformData&); |
| 84 bool isHashTableDeletedValue() const { return m_isHashTableDeletedValue; } |
| 85 bool fontContainsCharacter(UChar32 character); |
| 86 |
| 87 #if ENABLE(OPENTYPE_VERTICAL) |
| 88 PassRefPtr<OpenTypeVerticalData> verticalData() const; |
| 89 PassRefPtr<SharedBuffer> openTypeTable(uint32_t table) const; |
| 90 #endif |
| 91 |
| 92 #ifndef NDEBUG |
| 93 String description() const; |
| 94 #endif |
| 95 |
| 96 // The returned styles are all actual styles without FontRenderStyle::NoPref
erence. |
| 97 const FontRenderStyle& fontRenderStyle() const { return m_style; } |
| 98 void setupPaint(SkPaint*, GraphicsContext* = 0) const; |
| 99 |
| 100 static void setHinting(SkPaint::Hinting); |
| 101 static void setAutoHint(bool); |
| 102 static void setUseBitmaps(bool); |
| 103 static void setAntiAlias(bool); |
| 104 static void setSubpixelRendering(bool); |
| 105 |
| 106 private: |
| 107 bool static defaultUseSubpixelPositioning(); |
| 108 void querySystemForRenderStyle(bool useSkiaSubpixelPositioning); |
| 109 |
| 110 RefPtr<SkTypeface> m_typeface; |
| 111 CString m_family; |
| 112 float m_textSize; |
| 113 bool m_syntheticBold; |
| 114 bool m_syntheticItalic; |
| 115 FontOrientation m_orientation; |
| 116 FontRenderStyle m_style; |
| 117 mutable RefPtr<HarfBuzzFace> m_harfBuzzFace; |
| 118 bool m_isHashTableDeletedValue; |
| 119 }; |
| 120 |
| 121 } // namespace blink |
| 122 |
| 123 #endif // ifdef FontPlatformDataHarfBuzz_h |
| OLD | NEW |