RESOLVED FIXED 149237
Create a font which can be used for testing font features
https://bugs.webkit.org/show_bug.cgi?id=149237
Summary Create a font which can be used for testing font features
Myles C. Maxfield
Reported 2015-09-16 16:16:17 PDT
Create a font which can be used for testing font features
Attachments
Patch (52.94 KB, patch)
2015-09-16 16:37 PDT, Myles C. Maxfield
simon.fraser: review+
Myles C. Maxfield
Comment 1 2015-09-16 16:37:48 PDT
WebKit Commit Bot
Comment 2 2015-09-16 16:40:47 PDT
Attachment 261336 [details] did not pass style-queue: ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:9: Found header this file implements before WebCore config.h. Should be: config.h, primary header, blank line, and then alphabetically sorted. [build/include_order] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:12: Alphabetical sorting problem. [build/include_order] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:20: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:27: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:80: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:82: Use 'WTF::move()' instead of 'std::move()'. [runtime/wtf_move] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:139: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:149: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:161: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:171: Extra space after ( in function call [whitespace/parens] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:173: Extra space after ( in function call [whitespace/parens] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:179: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:180: Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons. [readability/comparison_to_zero] [5] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:189: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:226: Use 'WTF::move()' instead of 'std::move()'. [runtime/wtf_move] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:275: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:309: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:429: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:443: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:502: One line control clauses should not use braces. [whitespace/braces] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:505: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:607: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:630: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:653: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:673: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:674: Omit int when using unsigned [runtime/unsigned] [1] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:680: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:698: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:716: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:742: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:765: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:767: Could not find a newline character at the end of the file. [whitespace/ending_newline] [5] ERROR: Tools/FontWithFeatures/FontWithFeatures/main.cpp:10: Alphabetical sorting problem. [build/include_order] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/main.cpp:14: Streams are highly discouraged. [readability/streams] [3] ERROR: Tools/FontWithFeatures/FontWithFeatures/main.cpp:16: Bad include order. Mixing system and custom headers. [build/include_order] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/main.cpp:18: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/main.cpp:64: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Tools/FontWithFeatures/FontWithFeatures/main.cpp:100: Could not find a newline character at the end of the file. [whitespace/ending_newline] [5] Total errors found: 38 in 5 files If any of these errors are false positives, please file a bug against check-webkit-style.
Simon Fraser (smfr)
Comment 3 2015-09-16 17:04:40 PDT
Comment on attachment 261336 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=261336&action=review > Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:140 > +std::vector<uint8_t> generateBoxCharString() { > + CFFBuilder builder(unitsPerEm, std::make_pair(0.f, 0.f)); WebKit style is brace on new line. Needs fixing all over this file. > Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:267 > + bool active = { true }; no = > Tools/FontWithFeatures/FontWithFeatures/main.cpp:37 > + CGFloat fontSize = 25; > + CGContextSetTextMatrix(context, CGAffineTransformScale(CGAffineTransformIdentity, 1, 1)); > + CGContextSetTextPosition(context, location.x, location.y); > + CFNumberRef featureValue = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &value); > + CFTypeRef featureDictionaryKeys[] = { kCTFontOpenTypeFeatureTag, kCTFontOpenTypeFeatureValue }; > + CFTypeRef featureDictionaryValues[] = { feature, featureValue }; > + CFDictionaryRef featureDictionary = CFDictionaryCreate(kCFAllocatorDefault, featureDictionaryKeys, featureDictionaryValues, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); > + CFRelease(featureValue); > + CFTypeRef featureSettingsValues[] = { featureDictionary }; > + CFArrayRef fontFeatureSettings = CFArrayCreate(kCFAllocatorDefault, featureSettingsValues, 1, &kCFTypeArrayCallBacks); > + CFRelease(featureDictionary); > + CFTypeRef fontDescriptorKeys[] = { kCTFontFeatureSettingsAttribute }; > + CFTypeRef fontDescriptorValues[] = { fontFeatureSettings }; > + CFDictionaryRef fontDescriptorAttributes = CFDictionaryCreate(kCFAllocatorDefault, fontDescriptorKeys, fontDescriptorValues, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); > + CFRelease(fontFeatureSettings); > + CTFontDescriptorRef modifiedFontDescriptor = CTFontDescriptorCreateCopyWithAttributes(fontDescriptor, fontDescriptorAttributes); > + CFRelease(fontDescriptorAttributes); > + CTFontRef font = CTFontCreateWithFontDescriptor(modifiedFontDescriptor, fontSize, nullptr); > + CFRelease(modifiedFontDescriptor); Such a wall of code.
Myles C. Maxfield
Comment 4 2015-09-16 17:33:16 PDT
Comment on attachment 261336 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=261336&action=review > Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:17 > +static const uint16_t unitsPerEm = 1024; This should be int16_t. > Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:534 > + append16(clampTo<int16_t>(unitsPerEm)); // Typographical descender Might as well make is 1. > Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:537 > + append16(clampTo<uint16_t>(unitsPerEm)); // Windows-specific descent Ditto. > Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:656 > + append16(clampTo<int16_t>(unitsPerEm)); // descent Ditto.
Myles C. Maxfield
Comment 5 2015-09-16 18:15:48 PDT
Ryosuke Niwa
Comment 6 2015-09-16 22:17:11 PDT
The test added by this patch has been failing on Yosemite: https://bugs.webkit.org/show_bug.cgi?id=149246
Radar WebKit Bug Importer
Comment 7 2015-09-21 08:55:10 PDT
Note You need to log in before you can comment on or make changes to this bug.