Skip to content

Commit

Permalink
Move OTS to match Chromium
Browse files Browse the repository at this point in the history
Issue: 37501879
Reviewed-on: #2974
  • Loading branch information
dahlstrom-g committed Apr 18, 2024
2 parents 27c4a5c + 26fdc72 commit b18f884
Show file tree
Hide file tree
Showing 530 changed files with 1,194 additions and 113 deletions.
4 changes: 2 additions & 2 deletions cobalt/render_tree/resource_provider_stub.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
#include "cobalt/render_tree/lottie_animation.h"
#include "cobalt/render_tree/mesh.h"
#include "cobalt/render_tree/resource_provider.h"
#include "third_party/ots/include/opentype-sanitiser.h"
#include "third_party/ots/include/ots-memory-stream.h"
#include "third_party/ots/src/include/opentype-sanitiser.h"
#include "third_party/ots/src/include/ots-memory-stream.h"

namespace cobalt {
namespace render_tree {
Expand Down
4 changes: 2 additions & 2 deletions cobalt/renderer/rasterizer/skia/hardware_resource_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
#include "cobalt/renderer/rasterizer/skia/skottie_animation.h"
#include "cobalt/renderer/rasterizer/skia/typeface.h"
#include "starboard/configuration.h"
#include "third_party/ots/include/opentype-sanitiser.h"
#include "third_party/ots/include/ots-memory-stream.h"
#include "third_party/ots/src/include/opentype-sanitiser.h"
#include "third_party/ots/src/include/ots-memory-stream.h"
#include "third_party/skia/include/core/SkData.h"
#include "third_party/skia/include/core/SkStream.h"
#include "third_party/skia/include/core/SkTypeface.h"
Expand Down
4 changes: 2 additions & 2 deletions cobalt/renderer/rasterizer/skia/software_resource_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
#include "cobalt/renderer/rasterizer/skia/software_image.h"
#include "cobalt/renderer/rasterizer/skia/software_mesh.h"
#include "cobalt/renderer/rasterizer/skia/typeface.h"
#include "third_party/ots/include/opentype-sanitiser.h"
#include "third_party/ots/include/ots-memory-stream.h"
#include "third_party/ots/src/include/opentype-sanitiser.h"
#include "third_party/ots/src/include/ots-memory-stream.h"
#include "third_party/skia/include/core/SkData.h"
#include "third_party/skia/include/core/SkStream.h"
#include "third_party/skia/include/core/SkTypeface.h"
Expand Down
181 changes: 86 additions & 95 deletions third_party/ots/BUILD.gn
Original file line number Diff line number Diff line change
@@ -1,112 +1,103 @@
# Copyright 2021 The Cobalt Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//testing/libfuzzer/fuzzer_test.gni")

config("ots_config") {
include_dirs = [ "include" ]
include_dirs = [ "src/include" ]
defines = [ "HAVE_CONFIG_H" ]
}

static_library("ots") {
sources = [
"include/opentype-sanitiser.h",
"include/ots-memory-stream.h",
"src/avar.cc",
"src/avar.h",
"src/cff.cc",
"src/cff.h",
"src/cff_charstring.cc",
"src/cff_charstring.h",
"src/cmap.cc",
"src/cmap.h",
"src/cvar.cc",
"src/cvar.h",
"src/cvt.cc",
"src/cvt.h",
"src/fpgm.cc",
"src/fpgm.h",
"src/fvar.cc",
"src/fvar.h",
"src/gasp.cc",
"src/gasp.h",
"src/gdef.cc",
"src/gdef.h",
"src/glyf.cc",
"src/glyf.h",
"src/gpos.cc",
"src/gpos.h",
"src/gsub.cc",
"src/gsub.h",
"src/gvar.cc",
"src/gvar.h",
"src/hdmx.cc",
"src/hdmx.h",
"src/head.cc",
"src/head.h",
"src/hhea.cc",
"src/hhea.h",
"src/hmtx.h",
"src/hvar.cc",
"src/hvar.h",
"src/kern.cc",
"src/kern.h",
"src/layout.cc",
"src/layout.h",
"src/loca.cc",
"src/loca.h",
"src/ltsh.cc",
"src/ltsh.h",
"src/math.cc",
"src/math_.h",
"src/maxp.cc",
"src/maxp.h",
"src/metrics.cc",
"src/metrics.h",
"src/mvar.cc",
"src/mvar.h",
"src/name.cc",
"src/name.h",
"src/os2.cc",
"src/os2.h",
"src/ots.cc",
"src/ots.h",
"src/post.cc",
"src/post.h",
"src/prep.cc",
"src/prep.h",
"src/stat.cc",
"src/stat.h",
"src/variations.cc",
"src/variations.h",
"src/vdmx.cc",
"src/vdmx.h",
"src/vhea.cc",
"src/vhea.h",
"src/vmtx.h",
"src/vorg.cc",
"src/vorg.h",
"src/vvar.cc",
"src/vvar.h",
"src/include/opentype-sanitiser.h",
"src/include/ots-memory-stream.h",
"src/src/avar.cc",
"src/src/avar.h",
"src/src/cff.cc",
"src/src/cff.h",
"src/src/cff_charstring.cc",
"src/src/cff_charstring.h",
"src/src/cmap.cc",
"src/src/cmap.h",
"src/src/cvar.cc",
"src/src/cvar.h",
"src/src/cvt.cc",
"src/src/cvt.h",
"src/src/fpgm.cc",
"src/src/fpgm.h",
"src/src/fvar.cc",
"src/src/fvar.h",
"src/src/gasp.cc",
"src/src/gasp.h",
"src/src/gdef.cc",
"src/src/gdef.h",
"src/src/glyf.cc",
"src/src/glyf.h",
"src/src/gpos.cc",
"src/src/gpos.h",
"src/src/gsub.cc",
"src/src/gsub.h",
"src/src/gvar.cc",
"src/src/gvar.h",
"src/src/hdmx.cc",
"src/src/hdmx.h",
"src/src/head.cc",
"src/src/head.h",
"src/src/hhea.cc",
"src/src/hhea.h",
"src/src/hmtx.h",
"src/src/hvar.cc",
"src/src/hvar.h",
"src/src/kern.cc",
"src/src/kern.h",
"src/src/layout.cc",
"src/src/layout.h",
"src/src/loca.cc",
"src/src/loca.h",
"src/src/ltsh.cc",
"src/src/ltsh.h",
"src/src/math.cc",
"src/src/math_.h",
"src/src/maxp.cc",
"src/src/maxp.h",
"src/src/metrics.cc",
"src/src/metrics.h",
"src/src/mvar.cc",
"src/src/mvar.h",
"src/src/name.cc",
"src/src/name.h",
"src/src/os2.cc",
"src/src/os2.h",
"src/src/ots.cc",
"src/src/ots.h",
"src/src/post.cc",
"src/src/post.h",
"src/src/prep.cc",
"src/src/prep.h",
"src/src/stat.cc",
"src/src/stat.h",
"src/src/variations.cc",
"src/src/variations.h",
"src/src/vdmx.cc",
"src/src/vdmx.h",
"src/src/vhea.cc",
"src/src/vhea.h",
"src/src/vmtx.h",
"src/src/vorg.cc",
"src/src/vorg.h",
"src/src/vvar.cc",
"src/src/vvar.h",
]

public_configs = [ ":ots_config" ]

# configs += [ "//build/config/compiler:chromium_code" ]

deps = [
"//starboard/common",
"//third_party/brotli:dec",
"//third_party/woff2:woff2_dec",
"//third_party/zlib",
]

configs += [ "//build/config/compiler:no_chromium_code" ]
}
4 changes: 4 additions & 0 deletions third_party/ots/DIR_METADATA
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
monorail: {
component: "Blink>WebFonts"
}
team_email: "loading-dev@chromium.org"
52 changes: 52 additions & 0 deletions third_party/ots/INSTALL
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
Instructions below are for building standalone OTS utilities, if you want to
use OTS as a library then the recommended way is to copy the source code and
integrate it into your existing build system. Our build system does not build
a shared library intentionally.

General build instructions:

1. If you are building from cloned Git repository, you will need to update
the git sub modules, as well as run autoreconf. A convenience script is
provided:

$ ./autogen.sh

2. Build OTS

$ ./configure
$ make

3. Run the tests (if you wish)

$ make check

Building on Windows:

1. A POSIX-compatible environment is required to build OTS, MSYS2 is
recommended. Follow the installation instructions on
https://msys2.github.io/.

2. Install the required packages:

$ pacman -S autoconf automake pkg-config gcc make

3. Follow the general build instructions above.

Developer build instructions:

1. If you would like to see the source code lines related to reported
errors, then replace configure call above with:

$ ./configure --enable-debug

For example,

$ ./ots-sanitize ~/fonts/ofl/merriweathersans/MerriweatherSans-Bold.ttf
ERROR at src/layout.cc:100 (ParseScriptTable)
ERROR: Layout: DFLT table doesn't satisfy the spec. for script tag DFLT
ERROR at src/layout.cc:1247 (ParseScriptListTable)
ERROR: Layout: Failed to parse script table 0
ERROR at src/gsub.cc:642 (ots_gsub_parse)
ERROR: GSUB: Failed to parse script list table
ERROR at src/ots.cc:669 (ProcessGeneric)
Failed to sanitize file!
17 changes: 5 additions & 12 deletions third_party/ots/METADATA
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
name: "ots"
description:
"Subtree at third_party/ots."

third_party {
identifier {
type: "ChromiumVersion"
value: "90.0.4430.218" # from https://chromereleases.googleblog.com/2021/05/stable-channel-update-for-chrome-os_18.html
}
identifier {
type: "Git"
value: "https://chromium.googlesource.com/external/github.com/khaledhosny/ots.git"
version: "ee537ac096667eed6559124164c3e8482646fd77"
# from https://chromium.googlesource.com/chromium/src/+/90.0.4430.218/DEPS#275
value: "https://chromium.googlesource.com/chromium/src.git"
version: "be07a152d9098db1e9d104a559c811029ab3e450"
}
last_upgrade_date {
year: 2018
month: 2
day: 19
identifier {
type: "UpstreamSubdir"
value: "third_party/ots"
}
license_type: NOTICE
}

0 comments on commit b18f884

Please sign in to comment.