Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Unified Diff: third_party/go/src/golang.org/x/mobile/font/font_darwin.go

Issue 1275153002: Remove third_party/golang.org/x/mobile as it is no longer used with Go 1.5. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Remove golang.org/x/mobile Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/go/src/golang.org/x/mobile/font/font_darwin.go
diff --git a/third_party/go/src/golang.org/x/mobile/font/font_darwin.go b/third_party/go/src/golang.org/x/mobile/font/font_darwin.go
deleted file mode 100644
index e82713c05925d813471aa87f0f0e2d2bb0bf4f2e..0000000000000000000000000000000000000000
--- a/third_party/go/src/golang.org/x/mobile/font/font_darwin.go
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package font
-
-/*
-#cgo darwin LDFLAGS: -framework CoreFoundation -framework CoreText
-#include <CoreFoundation/CFArray.h>
-#include <CoreFoundation/CFBase.h>
-#include <CoreFoundation/CFData.h>
-#include <CoreText/CTFont.h>
-*/
-import "C"
-import "unsafe"
-
-func buildFont(f C.CTFontRef) []byte {
- ctags := C.CTFontCopyAvailableTables(f, C.kCTFontTableOptionExcludeSynthetic)
- tagsCount := C.CFArrayGetCount(ctags)
-
- var tags []uint32
- var dataRefs []C.CFDataRef
- var dataLens []uint32
-
- for i := C.CFIndex(0); i < tagsCount; i++ {
- tag := (C.CTFontTableTag)((uintptr)(C.CFArrayGetValueAtIndex(ctags, i)))
- dataRef := C.CTFontCopyTable(f, tag, 0) // retained
- tags = append(tags, uint32(tag))
- dataRefs = append(dataRefs, dataRef)
- dataLens = append(dataLens, uint32(C.CFDataGetLength(dataRef)))
- }
-
- totalLen := 0
- for _, l := range dataLens {
- totalLen += int(l)
- }
-
- // Big-endian output.
- buf := make([]byte, 0, 12+16*len(tags)+totalLen)
- write16 := func(x uint16) { buf = append(buf, byte(x>>8), byte(x)) }
- write32 := func(x uint32) { buf = append(buf, byte(x>>24), byte(x>>16), byte(x>>8), byte(x)) }
-
- // File format description: http://www.microsoft.com/typography/otspec/otff.htm
- write32(0x00010000) // version 1.0
- write16(uint16(len(tags))) // numTables
- write16(0) // searchRange
- write16(0) // entrySelector
- write16(0) // rangeShift
-
- // Table tags, includes offsets into following data segments.
- offset := uint32(12 + 16*len(tags)) // offset starts after table tags
- for i, tag := range tags {
- write32(tag)
- write32(0)
- write32(offset)
- write32(dataLens[i])
- offset += dataLens[i]
- }
-
- // Data segments.
- for i, dataRef := range dataRefs {
- data := (*[1<<31 - 2]byte)((unsafe.Pointer)(C.CFDataGetBytePtr(dataRef)))[:dataLens[i]]
- buf = append(buf, data...)
- C.CFRelease(C.CFTypeRef(dataRef))
- }
-
- return buf
-}
-
-func buildDefault() ([]byte, error) {
- return buildFont(C.CTFontCreateUIFontForLanguage(C.kCTFontSystemFontType, 0, nil)), nil
-}
-
-func buildMonospace() ([]byte, error) {
- return buildFont(C.CTFontCreateUIFontForLanguage(C.kCTFontUserFixedPitchFontType, 0, nil)), nil
-}
« no previous file with comments | « third_party/go/src/golang.org/x/mobile/font/font_android.go ('k') | third_party/go/src/golang.org/x/mobile/font/font_linux.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698