• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KHTML

FontDescription.cpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2007 Nicholas Shanks <contact@nickshanks.com>
00003  *
00004  * Redistribution and use in source and binary forms, with or without
00005  * modification, are permitted provided that the following conditions
00006  * are met:
00007  *
00008  * 1.  Redistributions of source code must retain the above copyright
00009  *     notice, this list of conditions and the following disclaimer. 
00010  * 2.  Redistributions in binary form must reproduce the above copyright
00011  *     notice, this list of conditions and the following disclaimer in the
00012  *     documentation and/or other materials provided with the distribution. 
00013  * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
00014  *     its contributors may be used to endorse or promote products derived
00015  *     from this software without specific prior written permission. 
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
00018  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00019  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00020  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
00021  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00022  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00023  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00024  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00026  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  */
00028 
00029 #include "config.h"
00030 #include "FontDescription.h"
00031 
00032 namespace WebCore {
00033 
00034 FontWeight FontDescription::lighterWeight(void) const
00035 {
00036     // FIXME: Should actually return the CSS weight corresponding to next lightest
00037     // weight of the currently used font family.
00038     switch (m_weight) {
00039         case FontWeight100:
00040         case FontWeight200:
00041             return FontWeight100;
00042 
00043         case FontWeight300:
00044             return FontWeight200;
00045 
00046         case FontWeight400:
00047         case FontWeight500:
00048             return FontWeight300;
00049 
00050         case FontWeight600:
00051         case FontWeight700:
00052             return FontWeight400;
00053 
00054         case FontWeight800:
00055             return FontWeight500;
00056 
00057         case FontWeight900:
00058             return FontWeight700;
00059     }
00060     ASSERT_NOT_REACHED();
00061     return FontWeightNormal;
00062 }
00063 
00064 FontWeight FontDescription::bolderWeight(void) const
00065 {
00066     // FIXME: Should actually return the CSS weight corresponding to next heaviest
00067     // weight of the currently used font family.
00068     switch (m_weight) {
00069         case FontWeight100:
00070         case FontWeight200:
00071             return FontWeight300;
00072 
00073         case FontWeight300:
00074             return FontWeight400;
00075 
00076         case FontWeight400:
00077         case FontWeight500:
00078             return FontWeight700;
00079 
00080         case FontWeight600:
00081         case FontWeight700:
00082             return FontWeight800;
00083 
00084         case FontWeight800:
00085         case FontWeight900:
00086             return FontWeight900;
00087     }
00088     ASSERT_NOT_REACHED();
00089     return FontWeightNormal;
00090 }
00091 
00092 } // namespace WebCore

KHTML

Skip menu "KHTML"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal