blob: 8b992588f536eb07be1d02f0180e7795adf4d1c9 [file] [log] [blame]
# 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.
import("//cobalt/content/fonts/variables.gni")
if (cobalt_font_package == "empty") {
copy("copy_font_data") {
sources = [ "$source_font_config_dir/fonts.xml" ]
outputs =
[ "$sb_static_contents_output_data_dir/fonts/{{source_file_part}}" ]
}
} else {
action("fonts_xml") {
script = "scripts/filter_fonts.py"
font_xml = "$source_font_config_dir/fonts.xml"
sources = [ font_xml ]
outputs = [ "$sb_static_contents_output_data_dir/fonts/fonts.xml" ]
args = [
"-i",
rebase_path(font_xml, root_build_dir),
"-o",
rebase_path(outputs[0], root_out_dir),
] + package_categories
}
copy("copy_fonts") {
if (copy_font_files) {
fonts = exec_script("scripts/filter_fonts.py",
[
"-i",
rebase_path("$source_font_config_dir/fonts.xml",
root_build_dir),
"-f",
source_font_files_dir,
] + package_categories,
"trim list lines",
[ "$source_font_config_dir/fonts.xml" ])
} else {
# Copy at least the fallback Roboto Subsetted font.
fonts = [ "$source_font_files_dir/Roboto-Regular-Subsetted.woff2" ]
}
sources = fonts
outputs =
[ "$sb_static_contents_output_data_dir/fonts/{{source_file_part}}" ]
}
group("copy_font_data") {
data_deps = [
":copy_fonts",
":fonts_xml",
]
}
}