Changeset 173521 in webkit
- Timestamp:
- Sep 11, 2014, 11:29:43 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 added
- 3 edited
-
ChangeLog (modified) (1 diff)
-
WebCore.xcodeproj/project.pbxproj (modified) (5 diffs)
-
svg/SVGPathBuilder.h (modified) (2 diffs)
-
svg/SVGToOTFFontConversion.cpp (added)
-
svg/SVGToOTFFontConversion.h (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r173520 r173521 1 2014-09-11 Myles C. Maxfield <mmaxfield@apple.com> <litherum@gmail.com> 2 3 Initial implementation of SVG to OTF font converter 4 https://bugs.webkit.org/show_bug.cgi?id=136688 5 6 Reviewed by Darin Adler. 7 8 This patch creates a new file and new function which turns an SVG font into an OpenType font. 9 This function is not very full featured, and as such is never called. However, it works with 10 fonts that only support simple horizontal basic multilingual plane codepoints. It has only 11 been tested on OS X, and does not have any automated tests. This patch is only jumping off 12 point, laying the basic groundwork for a more robust font converter. 13 14 The goal of this patch is to eventually allow us to delete the codepath with which we draw 15 text using SVG fonts. Using a native codepath instead will allow for better performance, 16 security, and code clarity. In my initial benchmarks, using this converter instead of the 17 SVG codepath is at least a 100x speed improvement (after running for 4 hours I stepped 18 away from my machine). 19 20 No new tests because the function is not ready to be called (yet!) 21 Initial implementation of SVG to OTF font converter 22 https://bugs.webkit.org/show_bug.cgi?id=136688 23 24 * WebCore.xcodeproj/project.pbxproj: Add new file. 25 * svg/SVGPathBuilder.h: Single function. Takes a SVGFontElement and returns a byte 26 * svg/SVGToOTFFontConversion.cpp: Added. 27 (WebCore::write32): Write a big-endian Int32. 28 (WebCore::write16): Write a big-endian Int16. 29 (WebCore::overwrite32): Overwrite an existing Int32 in a vector (instead of appending) 30 (WebCore::SVGToOTFFontConverter::GlyphData::GlyphData): Internal class to hold state during 31 function calls. 32 (WebCore::roundDownToPowerOfTwo): 33 (WebCore::SVGToOTFFontConverter::appendCMAPTable): See function name. 34 (WebCore::SVGToOTFFontConverter::appendHEADTable): Ditto. 35 (WebCore::clampTo): Used to clamp data types to fit into other data types. 36 (WebCore::SVGToOTFFontConverter::appendHHEATable): See function name. 37 (WebCore::SVGToOTFFontConverter::appendHMTXTable): Ditto. 38 (WebCore::SVGToOTFFontConverter::appendMAXPTable): Ditto. 39 (WebCore::SVGToOTFFontConverter::appendNAMETable): Ditto. 40 (WebCore::SVGToOTFFontConverter::appendOS2Table): Ditto. 41 (WebCore::SVGToOTFFontConverter::appendPOSTTable): Ditto. 42 (WebCore::isValidStringForCFF): The CFF font format only allows strings with particular 43 characters in them. 44 (WebCore::appendCFFValidString): Append a string assuming it's valid to append. 45 (WebCore::SVGToOTFFontConverter::appendCFFTable): See function name. 46 (WebCore::SVGToOTFFontConverter::appendVORGTable): Ditto. 47 (WebCore::writeCFFEncodedNumber): CFF has this wacky encoding scheme for encoding and 48 decoding numbers. 49 (WebCore::CFFBuilder::CFFBuilder): Subclass of SVGPathBuilder, which is used for building 50 CFF CharStrings (which are glyph path representations). 51 (WebCore::CFFBuilder::updateForConstituentPoint): Invoked for every point in a path, does 52 things like updates glyph bounding box information. 53 (WebCore::CFFBuilder::boundingBox): Getter. 54 (WebCore::transcodeGlyphPaths): SVG path data string -> CFF CharString 55 (WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter): Generate internal state ahead of 56 time before generating any tables. 57 (WebCore::isFourByteAligned): 58 (WebCore::calculateChecksum): OTF files have checksums. 59 (WebCore::SVGToOTFFontConverter::appendTable): Invoked for each entry in the table of 60 contents of the OTF font. 61 (WebCore::SVGToOTFFontConverter::convertSVGToOTFFont): Write out the tables. 62 (WebCore::convertSVGToOTFFont): Entry point. 63 * svg/SVGToOTFFontConversion.h: Added. 64 1 65 2014-09-11 Jer Noble <jer.noble@apple.com> 2 66 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r173457 r173521 953 953 1CB4214D0AF2B2CA0085AD91 /* DOMRangeInternal.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 8538F05A0AD722F1006A81D1 /* DOMRangeInternal.h */; }; 954 954 1CCA732210ADD44A00FD440D /* DOMHTMLInputElementPrivate.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 1CCA732110ADD43E00FD440D /* DOMHTMLInputElementPrivate.h */; }; 955 1CCDF5BD1990332400BCEBAD /* SVGToOTFFontConversion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CCDF5BB1990332400BCEBAD /* SVGToOTFFontConversion.cpp */; }; 956 1CCDF5BE1990332400BCEBAD /* SVGToOTFFontConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CCDF5BC1990332400BCEBAD /* SVGToOTFFontConversion.h */; }; 955 957 1CE83AC30ADAFFD7009354F6 /* DeleteButtonController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C4C8EFF0AD85D87009475CE /* DeleteButtonController.cpp */; }; 956 958 1CE83AC40ADAFFD8009354F6 /* DeleteButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C4C8F630AD8655D009475CE /* DeleteButton.cpp */; }; … … 7896 7898 1CAF34800A6C405200ABE06E /* WebScriptObjectPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebScriptObjectPrivate.h; sourceTree = "<group>"; }; 7897 7899 1CCA732110ADD43E00FD440D /* DOMHTMLInputElementPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHTMLInputElementPrivate.h; sourceTree = "<group>"; }; 7900 1CCDF5BB1990332400BCEBAD /* SVGToOTFFontConversion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGToOTFFontConversion.cpp; sourceTree = "<group>"; }; 7901 1CCDF5BC1990332400BCEBAD /* SVGToOTFFontConversion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGToOTFFontConversion.h; sourceTree = "<group>"; }; 7898 7902 1CD0B6200AABDB5000D0A3FF /* PublicDOMInterfaces.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PublicDOMInterfaces.h; sourceTree = "<group>"; }; 7899 7903 1CDD45E40BA9C84600F90147 /* DebugRelease.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = "<group>"; }; … … 20168 20172 B2E4EC960D00C22B00432643 /* SVGZoomEvent.idl */, 20169 20173 B28C6A260D00C44800334AA4 /* xlinkattrs.in */, 20174 1CCDF5BB1990332400BCEBAD /* SVGToOTFFontConversion.cpp */, 20175 1CCDF5BC1990332400BCEBAD /* SVGToOTFFontConversion.h */, 20170 20176 ); 20171 20177 path = svg; … … 24970 24976 B27B28260CEF0C0700D39D54 /* JSSVGFontElement.h in Headers */, 24971 24977 A83B79050CCAFF15000B0825 /* JSSVGFontFaceElement.h in Headers */, 24978 1CCDF5BE1990332400BCEBAD /* SVGToOTFFontConversion.h in Headers */, 24972 24979 A83B79000CCAFF15000B0825 /* JSSVGFontFaceFormatElement.h in Headers */, 24973 24980 A83B79020CCAFF15000B0825 /* JSSVGFontFaceNameElement.h in Headers */, … … 26974 26981 E1CDE92015018ED000862CC5 /* AsyncFileStream.cpp in Sources */, 26975 26982 0FFD4D6018651FA300512F6E /* AsyncScrollingCoordinator.cpp in Sources */, 26983 1CCDF5BD1990332400BCEBAD /* SVGToOTFFontConversion.cpp in Sources */, 26976 26984 A8C4A80E09D563270003AC8D /* Attr.cpp in Sources */, 26977 26985 FD629EA4154B47160006D026 /* AudioBasicInspectorNode.cpp in Sources */, -
trunk/Source/WebCore/svg/SVGPathBuilder.h
r163440 r173521 38 38 void setCurrentPath(Path* path) { m_path = path; } 39 39 40 protected: 41 FloatPoint m_current; 42 40 43 private: 41 44 virtual void incrementPathSegmentCount() override { } … … 58 61 59 62 Path* m_path; 60 FloatPoint m_current;61 63 }; 62 64
Note:
See TracChangeset
for help on using the changeset viewer.