Skip to content

Instantly share code, notes, and snippets.

<trak>
<version value="1.0"/>
<format value="0"/>
<horizData>
<!-- nTracks=3, nSizes=20 -->
<trackEntry value="-1.0" nameIndex="291">
<track size="6.0" value="146"/>
<track size="9.0" value="102"/>
<track size="10.0" value="88"/>
<track size="11.0" value="76"/>
<trak>
<version value="1.0"/>
<format value="0"/>
<horizData>
<!-- nTracks=3, nSizes=20 -->
<trackEntry value="-1.0" nameIndex="291">
<track size="6.0" value="54"/>
<track size="9.0" value="10"/>
<track size="10.0" value="-4"/>
<track size="11.0" value="-16"/>
@drott
drott / ViewController.swift
Created November 22, 2018 13:43
Variable Color Font Rendering Issue Reproduction
//
// Variable Color Font Rendering Issue Reproduction
// ViewController.swift
//
import Cocoa
class ViewController: NSViewController {
final class Line: NSView {
override func draw(_ dirtyRect: NSRect) {
@drott
drott / gist:633d25c3c4a56e1070226822314b1aa3
Created November 6, 2018 07:23
AAT / OpenType tables in Mac Fonts
Bangla MN.ttc tables: ['kern', 'GPOS', 'GSUB', 'morx']
Bangla MN.ttc tables: ['kern', 'GPOS', 'morx']
Bangla Sangam MN.ttc tables: ['GPOS', 'GSUB', 'morx']
ChalkboardSE.ttc tables: ['kern', 'GPOS', 'GSUB', 'morx']
Cochin.ttc tables: ['kern', 'GPOS', 'GSUB', 'morx']
Cochin.ttc tables: ['kern', 'GPOS', 'morx']
Damascus.ttc tables: ['GSUB', 'morx']
DecoTypeNaskh.ttc tables: ['GSUB', 'morx']
Devanagari Sangam MN.ttc tables: ['GPOS', 'GSUB', 'morx']
Futura.ttc tables: ['kern', 'GPOS', 'GSUB', 'morx']
@drott
drott / track_ot_coretext.py
Last active October 18, 2018 13:04
Quick script to overlay CoreText vs HB's own shaper for tracking
#!/usr/bin/env python3
import subprocess
from PIL import Image, ImageOps
import io
font_ptem_sizes = [
6,
9,
10,
11,
@drott
drott / hb_set_diff.patch
Created July 4, 2018 15:14
Hb Set differences 957e7756634a4fdf1654041e20e883cf964ecac9..2cb075fe26201f3e370fccfff6c1bc242b5acc79
diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh
index 3615c50e..ccd4d8df 100644
--- a/src/hb-set-private.hh
+++ b/src/hb-set-private.hh
@@ -158,21 +158,13 @@ struct hb_set_t
}
typedef unsigned long long elt_t;
- static const unsigned int PAGE_BITS = 1024;
+ static const unsigned int PAGE_BITS = 512;
// ../blink/src/third_party/llvm-build/Release+Asserts/bin/clang -std=c++11 -stdlib=libc++ -I../blink/src/skia/config -I../blink/src/third_party/skia/include -I../blink/src/third_party/skia/include/core -I../blink/src/third_party/skia/include/config -I../blink/src/third_party/skia/include/gpu -lstdc++ -L../blink/src/out/gndebug -lskia -Wl,-rpath,../blink/src/out/gndebug/ main.cpp -g -O1 -o noto_harfbuzz
#include "SkTypeface.h"
#include "SkString.h"
#include "SkSurface.h"
#include "SkCanvas.h"
#include "SkPaint.h"
#include "SkStream.h"
int main() {
@drott
drott / truncation_test.cpp
Created March 22, 2016 11:26
Test for integer truncation
#include <stdio.h>
// TIL, this compiles without warnings with
// $ clang -Wall main.cpp -o testTruncation
// The following local pragmas may be used to activate warnings for this case,
// if you can't use -Wconversion globally.
// #pragma GCC diagnostic push
// #pragma GCC diagnostic warning "-Wconversion"
<meta charset="utf-8">
<style type="text/css">
@font-face {
font-family: 'opensansweb';
src: url(https://fonts.gstatic.com/s/opensans/v13/cJZKeOuBrn4kERxqtaUH3ZBw1xU1rKptJj_0jans920.woff2) format('woff2');
unicode-range: U+0000-00FF, U+2000-206F;
}
body {
font-family: opensansweb;
../../third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp(643) : bool blink::collectCandidateRuns(const UChar *, size_t, const blink::Font *, Vector<blink::CandidateRun> *, bool)
ERROR: glyphPositionsLength: 4
../../third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp(917) : void blink::HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun(blink::HarfBuzzShaper::HarfBuzzRun *, hb_buffer_t *, blink::HarfBuzzShaper::HarfBuzzRun *)
ERROR: i: 0 ccIndex: 3 glyphInfos[i].cluster: 3 numGlyphs: 4
../../third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp(935) : void blink::HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun(blink::HarfBuzzShaper::HarfBuzzRun *, hb_buffer_t *, blink::HarfBuzzShaper::HarfBuzzRun *)
ERROR: i: 1 ccIndex: 2 glyphInfos[i].cluster: 2 numGlyphs: 4
../../third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp(935) : void blink::HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun(blink::HarfBuzzShaper::HarfBuzzRun *, hb_buffer_t *, blink::HarfBuzzSh