Skip to content

Commit

Permalink
Move cobalt/fonts to starboard/fonts (#3754)
Browse files Browse the repository at this point in the history
Removes reverse dependencies from Starboard back to Cobalt. No targets
within Starboard should refer to anything in /cobalt toplevel directory.

Test-On-Device: true

b/262794004
  • Loading branch information
kaidokert authored Jul 8, 2024
1 parent 0fe03ba commit 71ff44d
Show file tree
Hide file tree
Showing 164 changed files with 73 additions and 54 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ repos:
content/|
internal/starboard/shared/glimp/|
nb/|
starboard/content/fonts/LICENSES.txt |
starboard/android/apk/gradlew|
starboard/android/apk/app/src/main/java/dev/cobalt/media/MediaDrmBridge.java$|
starboard/shared/starboard/player/filter/decoded_audio_queue.cc$|
Expand Down
6 changes: 3 additions & 3 deletions cobalt/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ target(final_executable_type, "cobalt") {
]
data_deps = [ "//cobalt/network:copy_ssl_certificates" ]
if (cobalt_font_package == "empty") {
data_deps += [ "//cobalt/content/fonts:copy_font_data" ]
data_deps += [ "//starboard/content/fonts:copy_font_data" ]
} else {
data_deps += [
"//cobalt/content/fonts:copy_fonts",
"//cobalt/content/fonts:fonts_xml",
"//starboard/content/fonts:copy_fonts",
"//starboard/content/fonts:fonts_xml",
]
}
if (sb_is_evergreen) {
Expand Down
25 changes: 0 additions & 25 deletions cobalt/content/fonts/scripts/generate_roboto_regular_subsetted.py

This file was deleted.

6 changes: 3 additions & 3 deletions cobalt/layout_tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ target(gtest_target_type, "layout_tests") {
"//cobalt/network:copy_ssl_certificates",
]
if (cobalt_font_package == "empty") {
data_deps += [ "//cobalt/content/fonts:copy_font_data" ]
data_deps += [ "//starboard/content/fonts:copy_font_data" ]
} else {
data_deps += [
"//cobalt/content/fonts:copy_fonts",
"//cobalt/content/fonts:fonts_xml",
"//starboard/content/fonts:copy_fonts",
"//starboard/content/fonts:fonts_xml",
]
}
}
Expand Down
8 changes: 4 additions & 4 deletions cobalt/renderer/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ static_library("renderer") {
"//cobalt/base",
"//cobalt/browser/memory_settings:browser_memory_settings",
"//cobalt/configuration",
"//cobalt/content/fonts:copy_font_data",
"//cobalt/math",
"//cobalt/render_tree",
"//cobalt/render_tree:animations",
Expand All @@ -64,6 +63,7 @@ static_library("renderer") {
"//cobalt/system_window",
"//cobalt/watchdog",
"//starboard:starboard_headers_only",
"//starboard/content/fonts:copy_font_data",
]

if (is_starboard) {
Expand Down Expand Up @@ -141,11 +141,11 @@ target(gtest_target_type, "renderer_test") {
]

if (cobalt_font_package == "empty") {
data_deps += [ "//cobalt/content/fonts:copy_font_data" ]
data_deps += [ "//starboard/content/fonts:copy_font_data" ]
} else {
data_deps += [
"//cobalt/content/fonts:copy_fonts",
"//cobalt/content/fonts:fonts_xml",
"//starboard/content/fonts:copy_fonts",
"//starboard/content/fonts:fonts_xml",
]
}
}
Expand Down
8 changes: 4 additions & 4 deletions starboard/build/config/BUILDCONFIG.gn
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,11 @@ template("evergreen_loader") {
"//starboard/loader_app:copy_loader_app_content",
]
if (cobalt_font_package == "empty") {
shared_data_deps += [ "//cobalt/content/fonts:copy_font_data" ]
shared_data_deps += [ "//starboard/content/fonts:copy_font_data" ]
} else {
shared_data_deps += [
"//cobalt/content/fonts:copy_fonts",
"//cobalt/content/fonts:fonts_xml",
"//starboard/content/fonts:copy_fonts",
"//starboard/content/fonts:fonts_xml",
]
}
shared_library(target_name) {
Expand All @@ -382,8 +382,8 @@ template("evergreen_loader") {

deps = [
":copy_loader_app_lib${original_target_name}",
"//cobalt/content/fonts:copy_font_data",
"//starboard:starboard_group",
"//starboard/content/fonts:copy_font_data",
"//starboard/elf_loader:constants",
"//starboard/elf_loader:elf_loader",
"//starboard/elf_loader:evergreen_info",
Expand Down
2 changes: 1 addition & 1 deletion starboard/build/config/base_configuration.gni
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import("//cobalt/content/fonts/font_configuration.gni")
import("//starboard/build/config/clang.gni")
import("//starboard/build/config/enable_vr.gni")
import("//starboard/content/fonts/font_configuration.gni")

# NOTE:
# All build arguments in this file must have documentation.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import("//cobalt/content/fonts/variables.gni")
import("//starboard/content/fonts/variables.gni")

if (cobalt_font_package == "empty") {
copy("copy_font_data") {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<!--
| Copyright 2024 The Cobalt Authors. All Rights Reserved.
|
|==============================================================================
| OVERVIEW
| The font configuration files specify the local fonts available to Cobalt.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<!--
| Copyright 2024 The Cobalt Authors. All Rights Reserved.
|
|==============================================================================
| OVERVIEW
| The font configuration files specify the local fonts available to Cobalt.
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ Instructions for generating a minimal subset of 'Roboto-Regular.ttf for devices
with limited space:

1. Download `fontforge` using apt. `sudo apt install python-fontforge`
2. `cd src/cobalt/content/fonts/scripts`
2. `cd src/starboard/content/fonts/scripts`
3. `python generate_roboto_regular_subsetted.py`
4. Move 'Roboto-Regular-Subsetted.ttf' into 'cobalt/content/fonts/all_fonts'
4. Move 'Roboto-Regular-Subsetted.ttf' into 'starboard/content/fonts/all_fonts'
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def SelectFont(font_node, package_categories):
Args:
font_node: The <font> node to evaluate.
package_categories: Dictionary of package name to category number.
The category values are described in cobalt/content/fonts/README.md
The category values are described in starboard/content/fonts/README.md
Returns:
True to keep this font, False to delete it.
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/python2
# Copyright 2024 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.
#
"""Generates a minimal subset of the characters from Roboto-Regular."""

import fontforge


def main():
font = fontforge.open("Roboto-Regular.ttf")

# Add the .notdef glyph
font.selection.select(".notdef")
# Add Basic Latin
font.selection.select(("more", "ranges"), 0, 127)
# Add No-Break Space
font.selection.select(("more", "unicode"), 160)

# Clear out everything from the font but the selections.
font.selection.invert()
font.clear()

font.generate("Roboto-Regular-Subsetted.ttf")


if __name__ == "__main__":
main()
File renamed without changes.
2 changes: 1 addition & 1 deletion starboard/doc/evergreen/cobalt_evergreen_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ On Raspberry Pi the Cobalt fonts are configured the following way:

`empty` set of fonts under:
```
<kSbSystemPathContentDirectory>/app/cobalt/content/fonts
<kSbSystemPathContentDirectory>/app/starboard/content/fonts
```

`standard` or `limited` set of fonts under:
Expand Down
8 changes: 4 additions & 4 deletions starboard/elf_loader/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ if (sb_is_evergreen_compatible && current_toolchain == starboard_toolchain) {
if (current_toolchain == starboard_toolchain && host_os != "win") {
target(starboard_level_final_executable_type, "elf_loader_sandbox") {
if (cobalt_font_package == "empty") {
data_deps = [ "//cobalt/content/fonts:copy_font_data" ]
data_deps = [ "//starboard/content/fonts:copy_font_data" ]
} else {
data_deps = [
"//cobalt/content/fonts:copy_fonts",
"//cobalt/content/fonts:fonts_xml",
"//starboard/content/fonts:copy_fonts",
"//starboard/content/fonts:fonts_xml",
]
}

Expand All @@ -110,8 +110,8 @@ if (current_toolchain == starboard_toolchain && host_os != "win") {
":elf_loader",
":evergreen_info",
":sabi_string",
"//cobalt/content/fonts:copy_font_data",
"//starboard:starboard_group",
"//starboard/content/fonts:copy_font_data",
]

if (!sb_is_evergreen_compatible) {
Expand Down
10 changes: 5 additions & 5 deletions starboard/loader_app/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,18 @@ if (sb_is_evergreen_compatible && current_toolchain == starboard_toolchain) {
build_loader = false
if (target_cpu == "x64" || target_cpu == "arm" || target_cpu == "arm64") {
if (cobalt_font_package == "empty") {
data_deps = [ "//cobalt/content/fonts:copy_font_data" ]
data_deps = [ "//starboard/content/fonts:copy_font_data" ]
} else {
data_deps = [
"//cobalt/content/fonts:copy_fonts",
"//cobalt/content/fonts:fonts_xml",
"//starboard/content/fonts:copy_fonts",
"//starboard/content/fonts:fonts_xml",
]
}
sources = _common_loader_app_sources
deps = [
":common_loader_app_dependencies",
"//cobalt/content/fonts:copy_font_data",
"//starboard:starboard_with_main",
"//starboard/content/fonts:copy_font_data",
"//starboard/elf_loader",
]
if (sb_is_evergreen_compatible && sb_evergreen_compatible_package) {
Expand Down Expand Up @@ -140,7 +140,7 @@ if (sb_is_evergreen_compatible && current_toolchain == starboard_toolchain) {
]
deps = [
":common_loader_app_dependencies",
"//cobalt/content/fonts:copy_font_data",
"//starboard/content/fonts:copy_font_data",
"//starboard/elf_loader:elf_loader_sys",
]
}
Expand Down

0 comments on commit 71ff44d

Please sign in to comment.