bc7182206b
This test: (1) signs a font file with the test key. (2) side-loads the test cert to the device under test. (3) verifies that the signed font file can be installed. The device must be rootable for doing step (2). Bug: 176939176 Test: atest UpdatableSystemFontTest Change-Id: I7a9b614aa3c77589c3495b663cb76056ba657006
28 lines
844 B
Python
Executable File
28 lines
844 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
import argparse
|
|
|
|
from fontTools import ttLib
|
|
|
|
|
|
def update_font_revision(font, revisionSpec):
|
|
if revisionSpec.startswith('+'):
|
|
font['head'].fontRevision += float(revisionSpec[1:])
|
|
else:
|
|
font['head'].fontRevision = float(revisionSpec)
|
|
|
|
|
|
def main():
|
|
args_parser = argparse.ArgumentParser(description='Update font file metadata')
|
|
args_parser.add_argument('--input', help='Input otf/ttf font file.')
|
|
args_parser.add_argument('--output', help='Output file for updated font file.')
|
|
args_parser.add_argument('--revision', help='Updated font revision. Use + to update revision based on the current revision')
|
|
args = args_parser.parse_args()
|
|
|
|
font = ttLib.TTFont(args.input)
|
|
update_font_revision(font, args.revision)
|
|
font.save(args.output)
|
|
|
|
if __name__ == "__main__":
|
|
main()
|