github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/ui/scripts/font-convert (about)

     1  #!/usr/local/bin/fontforge
     2  
     3  # Copyright 2018 The Cockroach Authors.
     4  #
     5  # Licensed under the Apache License, Version 2.0 (the "License");
     6  # you may not use this file except in compliance with the License.
     7  # You may obtain a copy of the License at
     8  #
     9  #     http://www.apache.org/licenses/LICENSE-2.0
    10  #
    11  # Unless required by applicable law or agreed to in writing, software
    12  # distributed under the License is distributed on an "AS IS" BASIS,
    13  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
    14  # implied. See the License for the specific language governing
    15  # permissions and limitations under the License.
    16  
    17  # This script is intended to comply with the text of FAQ 2.2 of the SIL Open Font
    18  # License informational FAQ document.  Specifically, this script must convert the
    19  # complete original font without modification, and either exclude WOFF metadata or
    20  # set it to the complete original metadata.  It is believed that the below meets
    21  # these requirements.
    22  
    23  from os.path import splitext
    24  import sys
    25  
    26  if len(sys.argv) < 2:
    27      print("Usage: " + sys.argv[0] + " <FONT_FILE>")
    28      exit(-1)
    29  
    30  file = sys.argv[1]
    31  base = splitext(file)[0]
    32  
    33  font = fontforge.open(file)
    34  font.generate(base + ".woff")
    35  font.generate(base + ".woff2")