00001 /* 00002 * This file is part of the internal font implementation. It should not be included by anyone other than 00003 * FontMac.cpp, FontWin.cpp and Font.cpp. 00004 * 00005 * Copyright (C) 2006 Apple Computer, Inc. 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Library General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Library General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Library General Public License 00018 * along with this library; see the file COPYING.LIB. If not, write to 00019 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00020 * Boston, MA 02110-1301, USA. 00021 * 00022 */ 00023 00024 // This file has no guards on purpose in order to detect redundant includes. This is a private header 00025 // and so this should catch anyone trying to include this file in public cpp files. 00026 00027 #ifdef __OWB__ 00028 #include "Font.h" 00029 #endif //__OWB__ 00030 #include "FontData.h" 00031 #include "Shared.h" 00032 #include "FontSelector.h" 00033 #include <wtf/Vector.h> 00034 00035 #ifdef __OWB__ 00036 using BAL::Pitch; 00037 using BAL::BTFont; 00038 #endif //__OWB__ 00039 00040 namespace WebCore { 00041 00042 #ifndef __OWB__ 00043 class Font; 00044 #endif //__OWB__ 00045 class GraphicsContext; 00046 class IntRect; 00047 class FontDescription; 00048 class FontPlatformData; 00049 class FontSelector; 00050 00051 const int cAllFamiliesScanned = -1; 00052 00053 class FontFallbackList : public Shared<FontFallbackList> { 00054 public: 00055 FontFallbackList(); 00056 00057 void invalidate(PassRefPtr<FontSelector>); 00058 00059 #ifdef __OWB__ 00060 bool isFixedPitch(const BTFont* f) const { if (m_pitch == BAL::UnknownPitch) determinePitch(f); return m_pitch == BAL::FixedPitch; }; 00061 #else 00062 bool isFixedPitch(const Font* f) const { if (m_pitch == UnknownPitch) determinePitch(f); return m_pitch == FixedPitch; }; 00063 #endif 00064 void determinePitch(const Font*) const; 00065 00066 bool loadingCustomFonts() const { return m_loadingCustomFonts; } 00067 00068 FontSelector* fontSelector() const { return m_fontSelector.get(); } 00069 00070 private: 00071 const FontData* primaryFont(const Font* f) const { return fontDataAt(f, 0); } 00072 const FontData* fontDataAt(const Font*, unsigned index) const; 00073 const FontData* fontDataForCharacters(const Font*, const UChar*, int length) const; 00074 00075 void setPlatformFont(const FontPlatformData&); 00076 00077 mutable Vector<const FontData*, 1> m_fontList; 00078 mutable int m_familyIndex; 00079 mutable Pitch m_pitch; 00080 mutable bool m_loadingCustomFonts; 00081 RefPtr<FontSelector> m_fontSelector; 00082 00083 friend class Font; 00084 }; 00085 00086 } 00087