1#!/usr/bin/python
2# coding=UTF-8
3#
4# Copyright 2016 Google Inc. All rights reserved.
5#
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10#     http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17
18"""Create a curated subset of Noto Serif for Android."""
19
20import sys
21
22from nototools import subset
23from nototools import unicode_data
24
25# Characters we have decided we are doing as emoji-style in Android,
26# despite UTR #51's recommendation
27ANDROID_EMOJI = {
28    0x2600, # ☀ BLACK SUN WITH RAYS
29    0x2601, # ☁ CLOUD
30    0X260E, # ☎ BLACK TELEPHONE
31    0x261D, # ☝ WHITE UP POINTING INDEX
32    0x263A, # ☺ WHITE SMILING FACE
33    0x2660, # ♠ BLACK SPADE SUIT
34    0x2663, # ♣ BLACK CLUB SUIT
35    0x2665, # ♥ BLACK HEART SUIT
36    0x2666, # ♦ BLACK DIAMOND SUIT
37    0x270C, # ✌ VICTORY HAND
38    0x2744, # ❄ SNOWFLAKE
39    0x2764, # ❤ HEAVY BLACK HEART
40}
41
42def main(argv):
43    """Subset a Noto Serif font.
44
45    The first argument is the source file name, and the second argument is
46    the target file name.
47    """
48
49    source_file_name = argv[1]
50    target_file_name = argv[2]
51    subset.subset_font(
52        source_file_name,
53        target_file_name,
54        exclude=ANDROID_EMOJI)
55
56
57if __name__ == '__main__':
58    main(sys.argv)
59