Home | History | Annotate | Download | only in haiku
      1 /*
      2  * Copyright (C) 2006 Apple Computer, Inc.
      3  * Copyright (C) 2006 Zack Rusin <zack (at) kde.org>
      4  * Copyright (C) 2006 Dirk Mueller <mueller (at) kde.org>
      5  * Copyright (C) 2006 Nikolas Zimmermann <zimmermann (at) kde.org>
      6  * Copyright (C) 2007 Ryan Leavengood <leavengood (at) gmail.com>
      7  * Copyright (C) 2009 Maxime Simon <simon.maxime (at) gmail.com>
      8  *
      9  * All rights reserved.
     10  *
     11  * This library is free software; you can redistribute it and/or
     12  * modify it under the terms of the GNU Library General Public
     13  * License as published by the Free Software Foundation; either
     14  * version 2 of the License, or (at your option) any later version.
     15  *
     16  * This library is distributed in the hope that it will be useful,
     17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     19  * Library General Public License for more details.
     20  *
     21  * You should have received a copy of the GNU Library General Public License
     22  * along with this library; see the file COPYING.LIB.  If not, write to
     23  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
     24  * Boston, MA 02111-1307, USA.
     25  *
     26  */
     27 
     28 #ifndef FontPlatformData_h
     29 #define FontPlatformData_h
     30 
     31 #include "FontDescription.h"
     32 #include "GlyphBuffer.h"
     33 #include <interface/Font.h>
     34 
     35 namespace WebCore {
     36 
     37     class FontPlatformData {
     38     public:
     39         FontPlatformData(WTF::HashTableDeletedValueType)
     40             : m_font(hashTableDeletedFontValue())
     41             { }
     42 
     43         FontPlatformData()
     44             : m_font(0)
     45             { }
     46 
     47         FontPlatformData(const FontDescription&, const AtomicString& family);
     48         FontPlatformData(float size, bool bold, bool oblique);
     49         FontPlatformData(const FontPlatformData&);
     50 
     51         ~FontPlatformData();
     52 
     53         BFont* font() const { return m_font; }
     54 
     55         bool isFixedPitch();
     56         float size() const { return m_size; }
     57         bool bold() const { return m_bold; }
     58         bool oblique() const { return m_oblique; }
     59 
     60         unsigned hash() const;
     61         bool isHashTableDeletedValue() const;
     62 
     63         bool operator==(const FontPlatformData&) const;
     64 
     65 #ifndef NDEBUG
     66         String description() const;
     67 #endif
     68 
     69         BFont* m_font;
     70         float m_size;
     71         bool m_bold;
     72         bool m_oblique;
     73 
     74     private:
     75         static BFont* hashTableDeletedFontValue() { return reinterpret_cast<BFont*>(-1); }
     76     };
     77 
     78 } // namespace WebCore
     79 
     80 #endif
     81 
     82