Changeset 189890 in webkit


Ignore:
Timestamp:
Sep 16, 2015 6:15:27 PM (9 years ago)
Author:
mmaxfield@apple.com
Message:

Create a font which can be used for testing font features
https://bugs.webkit.org/show_bug.cgi?id=149237

Reviewed by Simon Fraser.

Tools:

This patch adds a new project in the Tools/ directory which generates a font which can
be used for testing font features. This is a standalone project consisting of two files:

  1. A file which actually generates the byte vector representing the font. This file has

a single public function: std::vector<uint8_t> generateFont(). This file is not platform
specific, and only relies on the C++ STL.

  1. A file with a main() which calls generateFont() and writes out the font, as well as

uses the font to render some demonstration text into a .png file. This file is platform
specific.

The font itself only supports the following characters:
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
However, the shape of these letters are either an X or a check mark.

The letter "A" always is a check mark.
The letter "B" always is an X.
Without any font features turned on, the rest of the letters are shown as X.

Each font feature has an letter associated with it. When the font feature is enabled,
that letter is shown as a check mark. For example, when "smcp" is enabled, "J" is shown
as a check mark.

Here are the mappings of font features to letters:
liga: C
clig: D
dlig: E
hlig: F
calt: G
subs: H
sups: I
smcp: J
c2sc: K
pcap: L
c2pc: M
unic: N
titl: O
onum: P
pnum: Q
tnum: R
frac: S
afrc: T
ordn: U
zero: V
hist: W
jp78: X
jp83: Y
jp90: Z
jp04: a
smpl: b
trad: c
fwid: d
pwid: e
ruby: f

  • FontWithFeatures/FontWithFeatures.xcodeproj/project.pbxproj: Added.
  • FontWithFeatures/FontWithFeatures/FontCreator.cpp: Added.

(integralLog2):
(roundDownToPowerOfTwo):
(isFourByteAligned):
(clampTo):
(append32):
(writeCFFEncodedNumber):
(CFFBuilder::CFFBuilder):
(CFFBuilder::takeResult):
(CFFBuilder::moveTo):
(CFFBuilder::lineTo):
(CFFBuilder::curveToCubic):
(CFFBuilder::closePath):
(CFFBuilder::writePoint):
(generateBoxCharString):
(generateCheckCharString):
(generateXCharString):
(charStringForGlyph):
(Generator::generate):
(Generator::Placeholder::Placeholder):
(Generator::Placeholder::populate):
(Generator::Placeholder::~Placeholder):
(Generator::placeholder):
(Generator::append16):
(Generator::append32):
(Generator::append32BitCode):
(Generator::overwrite16):
(Generator::overwrite32):
(Generator::appendCFFTable):
(Generator::appendSubstitutionSubtable):
(Generator::appendScriptSubtable):
(Generator::appendGSUBTable):
(Generator::appendOS2Table):
(Generator::appendFormat12CMAPTable):
(Generator::appendFormat4CMAPTable):
(Generator::appendCMAPTable):
(Generator::appendHEADTable):
(Generator::appendHHEATable):
(Generator::appendHMTXTable):
(Generator::appendMAXPTable):
(Generator::appendNAMETable):
(Generator::appendPOSTTable):
(Generator::calculateChecksum):
(Generator::appendTable):
(generateFont):

  • FontWithFeatures/FontWithFeatures/FontCreator.h: Added.
  • FontWithFeatures/FontWithFeatures/main.cpp: Added.

(drawTextWithFeature):
(main):

LayoutTests:

  • css3/font-feature-settings-rendering-2-expected.html: Added.
  • css3/font-feature-settings-rendering-2.html: Added.
  • css3/resources/FontWithFeatures.otf: Added.
  • platform/efl/TestExpectations:
  • platform/win/TestExpectations:
Location:
trunk
Files:
10 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r189880 r189890  
     12015-09-16  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Create a font which can be used for testing font features
     4        https://bugs.webkit.org/show_bug.cgi?id=149237
     5
     6        Reviewed by Simon Fraser.
     7
     8        * css3/font-feature-settings-rendering-2-expected.html: Added.
     9        * css3/font-feature-settings-rendering-2.html: Added.
     10        * css3/resources/FontWithFeatures.otf: Added.
     11        * platform/efl/TestExpectations:
     12        * platform/win/TestExpectations:
     13
    1142015-09-16  Brady Eidson  <beidson@apple.com>
    215
  • trunk/LayoutTests/platform/efl/TestExpectations

    r189837 r189890  
    7979# Need to implement font feature seeting for EFL port since r188146.
    8080css3/font-feature-settings-preinstalled-fonts.html [ Skip ]
     81css3/font-feature-settings-rendering-2.html [ Skip ]
    8182
    8283# No support system font punctuation in EFL yet. This test was added by r188377.
  • trunk/LayoutTests/platform/win/TestExpectations

    r189808 r189890  
    472472# Font feature settings is not implemented.
    473473css3/font-feature-settings-rendering.html [ Skip ]
     474css3/font-feature-settings-rendering-2.html [ Skip ]
    474475
    475476# TODO HiDPI tests require test infrastructure enhancements (e.g. testRunner.setBackingScaleFactor)
  • trunk/Tools/ChangeLog

    r189882 r189890  
     12015-09-16  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Create a font which can be used for testing font features
     4        https://bugs.webkit.org/show_bug.cgi?id=149237
     5
     6        Reviewed by Simon Fraser.
     7
     8        This patch adds a new project in the Tools/ directory which generates a font which can
     9        be used for testing font features. This is a standalone project consisting of two files:
     10        1. A file which actually generates the byte vector representing the font. This file has
     11        a single public function: std::vector<uint8_t> generateFont(). This file is not platform
     12        specific, and only relies on the C++ STL.
     13        2. A file with a main() which calls generateFont() and writes out the font, as well as
     14        uses the font to render some demonstration text into a .png file. This file is platform
     15        specific.
     16
     17        The font itself only supports the following characters:
     18        ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
     19        However, the shape of these letters are either an X or a check mark.
     20
     21        The letter "A" always is a check mark.
     22        The letter "B" always is an X.
     23        Without any font features turned on, the rest of the letters are shown as X.
     24
     25        Each font feature has an letter associated with it. When the font feature is enabled,
     26        that letter is shown as a check mark. For example, when "smcp" is enabled, "J" is shown
     27        as a check mark.
     28
     29        Here are the mappings of font features to letters:
     30        liga: C
     31        clig: D
     32        dlig: E
     33        hlig: F
     34        calt: G
     35        subs: H
     36        sups: I
     37        smcp: J
     38        c2sc: K
     39        pcap: L
     40        c2pc: M
     41        unic: N
     42        titl: O
     43        onum: P
     44        pnum: Q
     45        tnum: R
     46        frac: S
     47        afrc: T
     48        ordn: U
     49        zero: V
     50        hist: W
     51        jp78: X
     52        jp83: Y
     53        jp90: Z
     54        jp04: a
     55        smpl: b
     56        trad: c
     57        fwid: d
     58        pwid: e
     59        ruby: f
     60
     61        * FontWithFeatures/FontWithFeatures.xcodeproj/project.pbxproj: Added.
     62        * FontWithFeatures/FontWithFeatures/FontCreator.cpp: Added.
     63        (integralLog2):
     64        (roundDownToPowerOfTwo):
     65        (isFourByteAligned):
     66        (clampTo):
     67        (append32):
     68        (writeCFFEncodedNumber):
     69        (CFFBuilder::CFFBuilder):
     70        (CFFBuilder::takeResult):
     71        (CFFBuilder::moveTo):
     72        (CFFBuilder::lineTo):
     73        (CFFBuilder::curveToCubic):
     74        (CFFBuilder::closePath):
     75        (CFFBuilder::writePoint):
     76        (generateBoxCharString):
     77        (generateCheckCharString):
     78        (generateXCharString):
     79        (charStringForGlyph):
     80        (Generator::generate):
     81        (Generator::Placeholder::Placeholder):
     82        (Generator::Placeholder::populate):
     83        (Generator::Placeholder::~Placeholder):
     84        (Generator::placeholder):
     85        (Generator::append16):
     86        (Generator::append32):
     87        (Generator::append32BitCode):
     88        (Generator::overwrite16):
     89        (Generator::overwrite32):
     90        (Generator::appendCFFTable):
     91        (Generator::appendSubstitutionSubtable):
     92        (Generator::appendScriptSubtable):
     93        (Generator::appendGSUBTable):
     94        (Generator::appendOS2Table):
     95        (Generator::appendFormat12CMAPTable):
     96        (Generator::appendFormat4CMAPTable):
     97        (Generator::appendCMAPTable):
     98        (Generator::appendHEADTable):
     99        (Generator::appendHHEATable):
     100        (Generator::appendHMTXTable):
     101        (Generator::appendMAXPTable):
     102        (Generator::appendNAMETable):
     103        (Generator::appendPOSTTable):
     104        (Generator::calculateChecksum):
     105        (Generator::appendTable):
     106        (generateFont):
     107        * FontWithFeatures/FontWithFeatures/FontCreator.h: Added.
     108        * FontWithFeatures/FontWithFeatures/main.cpp: Added.
     109        (drawTextWithFeature):
     110        (main):
     111
    11122015-09-16  Commit Queue  <commit-queue@webkit.org>
    2113
Note: See TracChangeset for help on using the changeset viewer.