Skip to content

Instantly share code, notes, and snippets.

EVENT type 15 (RawButtonPress)
device: 12 (12)
detail: 1
valuators:
flags:
EVENT type 22 (RawTouchBegin)
device: 12 (12)
detail: 62
@drott
drott / gist:4215546
Created December 5, 2012 13:35
quick & dirty font metrics on c#
Code (adapted from http://msdn.microsoft.com/en-us/library/xwf9s90b.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-1 - this links also explains about the em/fontDesignUnits to Pixel conversion)
static void Main(string[] args)
{
int ascent;
float ascentPixel;
int descent;
float descentPixel;
int lineSpacing;
float lineSpacingPixel;
@drott
drott / gist:4249716
Created December 10, 2012 10:05
enabling subpixel
diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h
index 1603019..e345bb4 100644
--- a/Source/WTF/wtf/Platform.h
+++ b/Source/WTF/wtf/Platform.h
@@ -828,8 +828,8 @@
#endif
#if !defined(ENABLE_SUBPIXEL_LAYOUT)
-#if PLATFORM(CHROMIUM)
-#define ENABLE_SUBPIXEL_LAYOUT 1
--- a/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp
+++ b/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp
@@ -65,8 +65,12 @@ void SimpleFontData::platformInit()
m_fontMetrics.setAscent(ascent);
m_fontMetrics.setDescent(descent);
+#if !PLATFORM(EFL)
// Match CoreGraphics metrics.
m_fontMetrics.setLineSpacing(lroundf(ascent) + lroundf(descent) + lroundf(lineGap));
+#else
$ fio ~/dev/fioscenarios/gcclike
gcclike: (g=0): rw=randrw, bs=4K-9K/1800K-1800K, ioengine=sync, iodepth=1
...
gcclike: (g=0): rw=randrw, bs=4K-9K/1800K-1800K, ioengine=sync, iodepth=1
2.0.8
Starting 8 processes
gcclike: Laying out IO file(s) (1 file(s) / 256MB)
gcclike: Laying out IO file(s) (1 file(s) / 256MB)
gcclike: Laying out IO file(s) (1 file(s) / 256MB)
gcclike: Laying out IO file(s) (1 file(s) / 256MB)
[global]
description=Trying to simulate WebKit compilation on 8 cores
[gcclike]
numjobs=8
# average header size 4k, average cpp file size 9.5k, average object file size 1.8M
bssplit=4k/40:9k/40,1800k/100
direct=1
ioengine=sync
rw=randrw
$ fio -v ~/dev/fioscenarios/gcclike
2.0.8
gcclike: (g=0): rw=randrw, bs=4K-9K/1800K-1800K, ioengine=sync, iodepth=1
...
gcclike: (g=0): rw=randrw, bs=4K-9K/1800K-1800K, ioengine=sync, iodepth=1
2.0.8
Starting 8 processes
gcclike: Laying out IO file(s) (1 file(s) / 256MB)
gcclike: Laying out IO file(s) (1 file(s) / 256MB)
gcclike: Laying out IO file(s) (1 file(s) / 256MB)
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
base.OnPaint(e);
Graphics g = e.Graphics;
for (int i = 8; i <= 30; i++)
{
FontFamily fontFamily = new FontFamily("Liberation Sans");
Font liberation = new Font(fontFamily, i, FontStyle.Regular, GraphicsUnit.Pixel);
@drott
drott / git-gse
Last active June 1, 2016 16:44
I recommend putting git-gse in your $PATH then search for occurences of strings $@ in your repo, pretty fast.
#!/bin/sh
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Copyright (c) 2013 Dominik Röttsches
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
git grep -n -e "$@" -- "*.h" "*.hpp" "*.cpp" "*.c" "*.cc" "*.cpp" "*.inl"\
"*.grd" "*.idl" "*.m" "*.mm" "*.py" "*.sh" "*.cfg"\
"*.vcproj" "*.vsprops" "*.make"\
"*.gyp" "*.gypi" "*.js" "*.html" "*.css" "*.cmake" "*CMakeLists.txt"\
"*GNUmakefile.*"\
@drott
drott / gstreamerhashes.py
Last active December 29, 2015 02:09
Quick and dirty python script to download sha256 and generate md160 hashes for the common gstreamer deliverables
#!/usr/bin/python
import requests
import tempfile
import re
import hashlib
packages = [ "gstreamer", "gst-plugins-base", "gst-plugins-good", "gst-plugins-bad", "gst-plugins-ugly", "gst-libav" ]
base_url = 'http://gstreamer.freedesktop.org/src/'
version = '1.2.1'