Created
March 19, 2014 03:21
-
-
Save rubyu/9634923 to your computer and use it in GitHub Desktop.
フォントが入ったディレクトリを与えると、Anki用のCSSを吐く
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from __future__ import print_function | |
import os | |
import argparse | |
def get_arg(): | |
parser = argparse.ArgumentParser(prog="font_listing") | |
parser.add_argument("dir") | |
return parser.parse_args() | |
if __name__ == "__main__": | |
arg = get_arg() | |
for i, path in enumerate(os.listdir(unicode(arg.dir))): | |
filename = os.path.basename(path) | |
print("@font-face {{ font-family: _myfont{index}; src: url('{fontname}'); }}" | |
.format(index=i+1, fontname=filename)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment