Last active
December 21, 2015 20:39
-
-
Save robbestad/6362860 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
| " Hacks, etc. | |
| """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
| " statusline | |
| set laststatus=2 | |
| "let g:lightline = { 'colorscheme': 'wombat', 'component': { 'readonly': '%{&readonly?"⭤":""}', } } | |
| let g:lightline = { | |
| \ 'colorscheme': 'wombat', | |
| \ 'component': { | |
| \ 'readonly': '%{&readonly?"⭤":""}', | |
| \ }, | |
| \ 'separator': { 'left': '⮀', 'right': '⮂' }, | |
| \ 'subseparator': { 'left': '⮁', 'right': '⮃' } | |
| \ } | |
| set nocompatible " SET THIS FIRST! Use new hotness that's not compatible with Vi | |
| set guifont=/Users/svenanders/opensource/test/Monaco.dfont | |
| " BUNDLE CONFIG | |
| filetype off " required! | |
| set rtp+=~/.vim/bundle/vundle/ | |
| call vundle#rc() | |
| " ADD BUNDLES | |
| Bundle 'gmarik/vundle' | |
| Bundle 'itchyny/lightline.vim' | |
| " vim-scripts repos | |
| Bundle 'L9' | |
| Bundle 'FuzzyFinder' | |
| " sample bundles | |
| Bundle 'tpope/vim-fugitive' | |
| Bundle 'Lokaltog/vim-easymotion' | |
| Bundle 'rstacruz/sparkup', {'rtp': 'vim/'} | |
| " Shortcut to allow ; instead of : | |
| nnoremap ; : | |
| " Turn on syntax highlighting, keep it on | |
| :syntax on | |
| syntax sync fromstart | |
| autocmd BufReadPost * syntax sync fromstart | |
| " Allows multiple lines to be pasted correctly | |
| vnoremap p <Esc>:let current_reg = @"<CR>gvs<C-R>=current_reg<CR><Esc> | |
| """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
| " General settings | |
| """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
| " Tabs | |
| set softtabstop=4 " one backspace goes back a full 4 spaces -- makes the spaces feel like real tabs | |
| set tabstop=4 | |
| set shiftwidth=4 | |
| set expandtab | |
| syntax on | |
| set autoindent | |
| set copyindent " Copy the previous line's indentation when auto-indenting | |
| set shiftwidth=2 " Number of spaces to use for indenting via << >> | |
| set smarttab " Tell auto-indent to use shiftwidth instead of tabstop | |
| set softtabstop=2 " Number of spaces to use when inserting/deleting spaces instead of a tab | |
| set tabstop=2 " Number of spaces representing a tab | |
| " Don't bother saving backups, they're pointless (backups live in git) | |
| set nobackup | |
| set noswapfile | |
| " Remap :W to :w | |
| command W w | |
| " Everything else | |
| set backspace=indent,eol,start " allow backspacing over everything useful | |
| set encoding=utf-8 | |
| set exrc " read .vimrc, .exrc and .gvimrc | |
| set history=1000 " remember the last 1000 commands | |
| set incsearch " show search matches as you type | |
| set list | |
| "set listchars=tab:..,trail:⌫,extends:…,nbsp:_ | |
| set listchars=extends:…,tab:\ \ ,trail:⌫ | |
| " Some other cool stuff to use: ᅴ ᗛ ← ↔ ↝ ↠ ↤ ↩ ↲ ↺ ↻ ⇐ ⇠ ⇤ ⇥ ⇰ ∞ ⌦ ⌫ ⌧ ⏎ ☢ ☥ ☯ ☹ ☺ | |
| set noerrorbells " Don't beep at me, ever | |
| set noexpandtab | |
| set nowrap | |
| set number " Show line numbers | |
| set ruler | |
| set showcmd | |
| set showmatch " Show matching parenthesis | |
| set title " change the window's title to the current filename | |
| set undolevels=9001 | |
| set vb " Verbose error messaging just in case | |
| set visualbell | |
| set wrapscan | |
| " No wrapping, even when a new file is opened! | |
| autocmd BufReadPost * set nowrap | |
| """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
| " Language-specific stuff | |
| """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
| let php_htmlInStrings=1 | |
| let php_sql_query=1 | |
| " Markdown | |
| augroup md | |
| " Note: turns wrapping back on! | |
| autocmd BufRead *.md set ai formatoptions=tcroqn2 comments=n:> wrap | |
| augroup END | |
| " Some languages work best with spaces for indentation (Python, YAML…) | |
| autocmd BufRead,BufNewFile *.py set filetype=python ts=2 sw=2 sts=2 expandtab | |
| autocmd BufRead,BufNewFile *.yaml set filetype=yaml ts=2 sw=2 sts=2 expandtab | |
| """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
| " KEY MAPPINGS | |
| """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
| " Select tabs with command+#, just like in iTerm, Firefox, Chrome, etc. <3 | |
| map <D-1> 1gt | |
| map <D-2> 2gt | |
| map <D-3> 3gt | |
| map <D-4> 4gt | |
| map <D-5> 5gt | |
| map <D-6> 6gt | |
| map <D-7> 7gt | |
| map <D-8> 8gt | |
| map <D-9> 9gt | |
| """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
| " Fix common typos | |
| """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
| abbreviate accesories accessories | |
| abbreviate accomodate accommodate | |
| abbreviate acheive achieve | |
| abbreviate acheiving achieving | |
| abbreviate acn can | |
| abbreviate acommodate accommodate | |
| abbreviate acommodated accommodated | |
| abbreviate acomodate accommodate | |
| abbreviate acomodated accommodated | |
| abbreviate adn and | |
| abbreviate agian again | |
| abbreviate ahppen happen | |
| abbreviate ahve have | |
| abbreviate ahve have | |
| abbreviate allready already | |
| abbreviate almsot almost | |
| abbreviate alos also | |
| abbreviate alot a lot | |
| abbreviate alreayd already | |
| abbreviate alwasy always | |
| abbreviate amke make | |
| abbreviate anbd and | |
| abbreviate andthe and the | |
| abbreviate aniamte animate | |
| abbreviate aplyed applied | |
| abbreviate appeares appears | |
| abbreviate artical article | |
| abbreviate aslo also | |
| abbreviate audeince audience | |
| abbreviate audiance audience | |
| abbreviate awya away | |
| abbreviate bakc back | |
| abbreviate balence balance | |
| abbreviate baout about | |
| abbreviate bcak back | |
| abbreviate beacuse because | |
| abbreviate becasue because | |
| abbreviate becaues because | |
| abbreviate becomeing becoming | |
| abbreviate becuase because | |
| abbreviate becuse because | |
| abbreviate befoer before | |
| abbreviate begining beginning | |
| abbreviate beleive believe | |
| abbreviate bianries binaries | |
| abbreviate bianry binary | |
| abbreviate boxs boxes | |
| abbreviate bve be | |
| abbreviate changeing changing | |
| abbreviate charachter character | |
| abbreviate charcter character | |
| abbreviate charcters characters | |
| abbreviate charecter character | |
| abbreviate charector character | |
| abbreviate cheif chief | |
| abbreviate circut circuit | |
| abbreviate claer clear | |
| abbreviate claerly clearly | |
| abbreviate cna can | |
| abbreviate colection collection | |
| abbreviate comany company | |
| abbreviate comapny company | |
| abbreviate comittee committee | |
| abbreviate commitee committee | |
| abbreviate committe committee | |
| abbreviate committy committee | |
| abbreviate compair compare | |
| abbreviate compleated completed | |
| abbreviate completly completely | |
| abbreviate comunicate communicate | |
| abbreviate comunity community | |
| abbreviate conected connected | |
| abbreviate cotten cotton | |
| abbreviate coudl could | |
| abbreviate cpoy copy | |
| abbreviate cxan can | |
| abbreviate danceing dancing | |
| abbreviate debice device | |
| abbreviate definately definitely | |
| abbreviate develope develop | |
| abbreviate developement development | |
| abbreviate differant different | |
| abbreviate differnt different | |
| abbreviate diffrent different | |
| abbreviate disatisfied dissatisfied | |
| abbreviate doese does | |
| abbreviate doign doing | |
| abbreviate doller dollars | |
| abbreviate donig doing | |
| abbreviate driveing driving | |
| abbreviate drnik drink | |
| abbreviate dtae date | |
| abbreviate ehco echo | |
| abbreviate ehr her | |
| abbreviate embarass embarrass | |
| abbreviate equippment equipment | |
| abbreviate esle else | |
| abbreviate excitment excitement | |
| abbreviate exmaple example | |
| abbreviate exmaples examples | |
| abbreviate eyt yet | |
| abbreviate familar familiar | |
| abbreviate feild field | |
| abbreviate fianlly finally | |
| abbreviate fidn find | |
| abbreviate firts first | |
| abbreviate follwo follow | |
| abbreviate follwoing following | |
| abbreviate foriegn foreign | |
| abbreviate foudn found | |
| abbreviate foward forward | |
| abbreviate freind friend | |
| abbreviate friday Friday | |
| abbreviate frmo from | |
| abbreviate fro for | |
| abbreviate fucntino function | |
| abbreviate fucntion function | |
| abbreviate functino function | |
| abbreviate fwe few | |
| abbreviate gerat great | |
| abbreviate geting getting | |
| abbreviate giveing giving | |
| abbreviate goign going | |
| abbreviate gonig going | |
| abbreviate govenment government | |
| abbreviate gruop group | |
| abbreviate grwo grow | |
| abbreviate haev have | |
| abbreviate happend happened | |
| abbreviate haveing having | |
| abbreviate hda had | |
| abbreviate helpfull helpful | |
| abbreviate herat heart | |
| abbreviate hge he | |
| abbreviate hismelf himself | |
| abbreviate hsa has | |
| abbreviate hsi his | |
| abbreviate hsould should | |
| abbreviate hte the | |
| abbreviate htere there | |
| abbreviate htey they | |
| abbreviate hting thing | |
| abbreviate htink think | |
| abbreviate htis this | |
| abbreviate hvae have | |
| abbreviate hvaing having | |
| abbreviate hwen when | |
| abbreviate idae idea | |
| abbreviate idaes ideas | |
| abbreviate ihs his | |
| abbreviate immediatly immediately | |
| abbreviate includign including | |
| abbreviate indecate indicate | |
| abbreviate insted intead | |
| abbreviate inthe in the | |
| abbreviate iwll will | |
| abbreviate iwth with | |
| abbreviate jsut just | |
| abbreviate knwo know | |
| abbreviate knwos knows | |
| abbreviate konw know | |
| abbreviate konws knows | |
| abbreviate levle level | |
| abbreviate libary library | |
| abbreviate librarry library | |
| abbreviate librarry library | |
| abbreviate librery library | |
| abbreviate liek like | |
| abbreviate liekd liked | |
| abbreviate liev live | |
| abbreviate likly likely | |
| abbreviate littel little | |
| abbreviate liuke like | |
| abbreviate liveing living | |
| abbreviate loev love | |
| abbreviate lonly lonely | |
| abbreviate makeing making | |
| abbreviate mkae make | |
| abbreviate mkaes makes | |
| abbreviate mkaing making | |
| abbreviate moeny money | |
| abbreviate monday Monday | |
| abbreviate mroe more | |
| abbreviate mysefl myself | |
| abbreviate myu my | |
| abbreviate neccessary necessary | |
| abbreviate necesary necessary | |
| abbreviate nkow know | |
| abbreviate nwe new | |
| abbreviate nwo now | |
| abbreviate ocasion occasion | |
| abbreviate occassion occasion | |
| abbreviate occurence occurrence | |
| abbreviate occurrance occurrence | |
| abbreviate ocur occur | |
| abbreviate oging going | |
| abbreviate ohter other | |
| abbreviate omre more | |
| abbreviate onyl only | |
| abbreviate opperation operation | |
| abbreviate optoin option | |
| abbreviate optoins options | |
| abbreviate orginized organized | |
| abbreviate otehr other | |
| abbreviate otu out | |
| abbreviate owrk work | |
| abbreviate peopel people | |
| abbreviate perhasp perhaps | |
| abbreviate perhpas perhaps | |
| abbreviate pleasent pleasant | |
| abbreviate poen open | |
| abbreviate poeple people | |
| abbreviate porblem problem | |
| abbreviate preceed precede | |
| abbreviate preceeded preceded | |
| abbreviate probelm problem | |
| abbreviate protoge protege | |
| abbreviate puting putting | |
| abbreviate pwoer power | |
| abbreviate quater quarter | |
| abbreviate questoin question | |
| abbreviate reccomend recommend | |
| abbreviate reccommend recommend | |
| abbreviate receieve receive | |
| abbreviate recieve receive | |
| abbreviate recieved received | |
| abbreviate recomend recommend | |
| abbreviate reconize recognize | |
| abbreviate recrod record | |
| abbreviate religous religious | |
| abbreviate reutnr return | |
| abbreviate rwite write | |
| abbreviate rythm rhythm | |
| abbreviate sacle scale | |
| abbreviate saturday Saturday | |
| abbreviate selectoin selection | |
| abbreviate sentance sentence | |
| abbreviate seperate separate | |
| abbreviate shineing shining | |
| abbreviate shiped shipped | |
| abbreviate shoud should | |
| abbreviate shoudl should | |
| abbreviate similiar similar | |
| abbreviate smae same | |
| abbreviate smoe some | |
| abbreviate soem some | |
| abbreviate sohw show | |
| abbreviate soudn sound | |
| abbreviate soudns sounds | |
| abbreviate sould should | |
| abbreviate statment statement | |
| abbreviate stnad stand | |
| abbreviate stopry story | |
| abbreviate stoyr story | |
| abbreviate stpo stop | |
| abbreviate strDtat strData | |
| abbreviate strentgh strength | |
| abbreviate struggel struggle | |
| abbreviate sucess success | |
| abbreviate sunday Sunday | |
| abbreviate swiming swimming | |
| abbreviate tahn than | |
| abbreviate taht that | |
| abbreviate talekd talked | |
| abbreviate tath that | |
| abbreviate teh the | |
| abbreviate teh the | |
| abbreviate tehy they | |
| abbreviate tghe the | |
| abbreviate thansk thanks | |
| abbreviate themselfs themselves | |
| abbreviate theri their | |
| abbreviate thgat that | |
| abbreviate thge the | |
| abbreviate thier their | |
| abbreviate thme them | |
| abbreviate thna than | |
| abbreviate thne then | |
| abbreviate thnig thing | |
| abbreviate thnigs things | |
| abbreviate thnik think | |
| abbreviate thsi this | |
| abbreviate thsoe those | |
| abbreviate thta that | |
| abbreviate thursday Thursday | |
| abbreviate tihnk think | |
| abbreviate tihs this | |
| abbreviate timne time | |
| abbreviate tje the | |
| abbreviate tjhe the | |
| abbreviate tkae take | |
| abbreviate tkaes takes | |
| abbreviate tkaing taking | |
| abbreviate tlaking talking | |
| abbreviate todya today | |
| abbreviate tongiht tonight | |
| abbreviate tonihgt tonight | |
| abbreviate towrad toward | |
| abbreviate tpyo typo | |
| abbreviate truely truly | |
| abbreviate tuesday Tuesday | |
| abbreviate tyhat that | |
| abbreviate tyhe the | |
| abbreviate useing using | |
| abbreviate veyr very | |
| abbreviate vrey very | |
| abbreviate waht what | |
| abbreviate watn want | |
| abbreviate wednesday Wednesday | |
| abbreviate wehn when | |
| abbreviate whcih which | |
| abbreviate whic which | |
| abbreviate whihc which | |
| abbreviate whta what | |
| abbreviate wief wife | |
| abbreviate wierd weird | |
| abbreviate wihch which | |
| abbreviate wiht with | |
| abbreviate windoes windows | |
| abbreviate withe with | |
| abbreviate wiull will | |
| abbreviate wnat want | |
| abbreviate wnated wanted | |
| abbreviate wnats wants | |
| abbreviate woh who | |
| abbreviate wohle whole | |
| abbreviate wokr work | |
| abbreviate woudl would | |
| abbreviate wriet write | |
| abbreviate wrod word | |
| abbreviate wroking working | |
| abbreviate wtih with | |
| abbreviate wya way | |
| abbreviate yera year | |
| abbreviate yeras years | |
| abbreviate yoru your | |
| abbreviate ytou you | |
| abbreviate yuo you | |
| abbreviate yuor your | |
| set paste |
This file contains hidden or 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
| #!/usr/bin/env python | |
| """Font patcher for Powerline. | |
| Creates dividers and symbols for use with Powerline. Requires FontForge with Python bindings. | |
| Stores glyphs in the 2b60-2bff Unicode range ("Misc symbols and arrows"). | |
| [2b60] Branch symbol | |
| [2b61] LN (line) symbol | |
| [2b62] FT symbol 1 | |
| [2b63] FT symbol 2 | |
| [2b64] Padlock (closed) symbol | |
| [2b80] Hard right arrow | |
| [2b81] Soft right arrow | |
| [2b82] Hard left arrow | |
| [2b83] Soft left arrow | |
| """ | |
| from __future__ import division | |
| import argparse | |
| import os | |
| import sys | |
| import re | |
| try: | |
| import fontforge | |
| import psMat | |
| except ImportError: | |
| sys.stderr.write('The required FontForge modules could not be loaded.\n\n') | |
| if sys.version_info.major > 2: | |
| sys.stderr.write('FontForge only supports Python 2. Please run this script with the Python 2 executable - e.g. "python2 {0}"\n'.format(sys.argv[0])) | |
| else: | |
| sys.stderr.write('You need FontForge with Python bindings for this script to work.\n') | |
| sys.exit(1) | |
| # Handle command-line arguments | |
| parser = argparse.ArgumentParser(description='Font patcher for Powerline. Creates dividers and symbols in FontForge-compatible font files. Requires FontForge with Python bindings. Stores glyphs in the U+2B80-U+2BFF range ("Miscellaneous symbols and arrows"). Stores the patched font as a new, renamed font file by default.') | |
| parser.add_argument('fonts', help='font file to patch', metavar='font', nargs='+') | |
| parser.add_argument('--no-rename', help='don\'t add " for Powerline" to the font name', default=True, action='store_false', dest='rename') | |
| parser.add_argument('--symbol-font', help='font file with symbols', metavar='font', dest='symbol_font', default='{0}/PowerlineSymbols.sfd'.format(sys.path[0])) | |
| parser.add_argument('--fix-mono', help='fixes some mono-fonts which have glyphs of 0 widths', default=False, action='store_true', dest='fixmono') | |
| parser.add_argument('--fix-win', help='modifies font names such that Windows correctly recognizes font families', default=False, action='store_true', dest='fixwin') | |
| args = parser.parse_args() | |
| SYM_ATTR = { | |
| # Right/left-aligned glyphs will have their advance width reduced in order to overlap the next glyph slightly | |
| 0x2b60: { 'align': 'c', 'stretch': 'y' , 'overlap': False }, | |
| 0x2b61: { 'align': 'c', 'stretch': '' , 'overlap': False }, | |
| 0x2b62: { 'align': 'r', 'stretch': '' , 'overlap': False }, | |
| 0x2b63: { 'align': 'l', 'stretch': '' , 'overlap': False }, | |
| 0x2b64: { 'align': 'c', 'stretch': '' , 'overlap': False }, | |
| 0x2b80: { 'align': 'l', 'stretch': 'xy', 'overlap': True }, | |
| 0x2b81: { 'align': 'l', 'stretch': 'xy', 'overlap': True }, | |
| 0x2b82: { 'align': 'r', 'stretch': 'xy', 'overlap': True }, | |
| 0x2b83: { 'align': 'r', 'stretch': 'xy', 'overlap': True }, | |
| } | |
| # Open symbol font | |
| try: | |
| symbols = fontforge.open(args.symbol_font) | |
| except EnvironmentError: | |
| sys.exit(1) | |
| # Patch provided fonts | |
| for font_path in args.fonts: | |
| try: | |
| font = fontforge.open(font_path) | |
| except EnvironmentError: | |
| sys.exit(1) | |
| # Rename font | |
| if args.rename: | |
| font.familyname += ' for Powerline' | |
| font.fullname += ' for Powerline' | |
| font.fontname += 'ForPowerline' | |
| font.appendSFNTName('English (US)', 'Preferred Family', font.familyname) | |
| font.appendSFNTName('English (US)', 'Compatible Full', font.fullname) | |
| if args.fixwin: | |
| font.fontname = re.sub(r'\W', '', font.familyname) | |
| # Force the em size to be equal | |
| symbols.em = font.em | |
| # Initial font dimensions | |
| font_dim = { | |
| 'xmin' : 0, | |
| 'ymin' : -font.descent, | |
| 'xmax' : 0, | |
| 'ymax' : font.ascent, | |
| 'width' : 0, | |
| 'height': 0, | |
| } | |
| # Find the biggest char width and height | |
| # | |
| # 0x00-0x17f is the Latin Extended-A range | |
| # 0x2500-0x2600 is the box drawing range | |
| for glyph in range(0x00, 0x17f) + range(0x2500, 0x2600): | |
| try: | |
| (xmin, ymin, xmax, ymax) = font[glyph].boundingBox() | |
| except TypeError: | |
| continue | |
| if font_dim['width'] == 0: | |
| font_dim['width'] = font[glyph].width | |
| if ymin < font_dim['ymin']: font_dim['ymin'] = ymin | |
| if ymax > font_dim['ymax']: font_dim['ymax'] = ymax | |
| if xmax > font_dim['xmax']: font_dim['xmax'] = xmax | |
| # Calculate font height | |
| font_dim['height'] = abs(font_dim['ymin']) + font_dim['ymax'] | |
| # Update the font encoding to ensure that the Unicode glyphs are available | |
| font.encoding = 'ISO10646' | |
| # Fetch this property before adding outlines | |
| onlybitmaps = font.onlybitmaps | |
| def get_dim(glyph): | |
| bbox = glyph.boundingBox() | |
| return { | |
| 'xmin' : bbox[0], | |
| 'ymin' : bbox[1], | |
| 'xmax' : bbox[2], | |
| 'ymax' : bbox[3], | |
| 'width' : bbox[2] + (-bbox[0]), | |
| 'height': bbox[3] + (-bbox[1]), | |
| } | |
| # Create glyphs from symbol font | |
| for sym_glyph in symbols.glyphs(): | |
| sym_attr = SYM_ATTR[sym_glyph.unicode] | |
| # Prepare symbol glyph dimensions | |
| sym_dim = get_dim(sym_glyph) | |
| # Select and copy symbol from its encoding point | |
| symbols.selection.select(sym_glyph.encoding) | |
| symbols.copy() | |
| # Select and paste symbol to its unicode code point | |
| font.selection.select(sym_glyph.unicode) | |
| font.paste() | |
| # Now that we have copy/pasted the glyph, it's time to scale and move it | |
| # Handle glyph stretching | |
| if 'x' in sym_attr['stretch']: | |
| # Stretch the glyph horizontally | |
| scale_ratio = font_dim['width'] / sym_dim['width'] | |
| font.transform(psMat.scale(scale_ratio, 1)) | |
| if 'y' in sym_attr['stretch']: | |
| # Stretch the glyph vertically | |
| scale_ratio = font_dim['height'] / sym_dim['height'] | |
| font.transform(psMat.scale(1, scale_ratio)) | |
| # Use the dimensions from the pasted and stretched glyph | |
| sym_dim = get_dim(font[sym_glyph.unicode]) | |
| # Center-align the glyph vertically | |
| font_ycenter = font_dim['height'] / 2 | |
| sym_ycenter = sym_dim['height'] / 2 | |
| # First move it to the ymax (top) | |
| font.transform(psMat.translate(0, font_dim['ymax'] - sym_dim['ymax'])) | |
| # Then move it the y center difference | |
| font.transform(psMat.translate(0, sym_ycenter - font_ycenter)) | |
| # Ensure that the glyph doesn't extend outside the font's bounding box | |
| if sym_dim['width'] > font_dim['width']: | |
| # The glyph is too wide, scale it down to fit | |
| scale_matrix = psMat.scale(font_dim['width'] / sym_dim['width'], 1) | |
| font.transform(scale_matrix) | |
| # Use the dimensions from the stretched glyph | |
| sym_dim = get_dim(font[sym_glyph.unicode]) | |
| # Handle glyph alignment | |
| if sym_attr['align'] == 'c': | |
| # Center align | |
| align_matrix = psMat.translate(font_dim['width'] / 2 - sym_dim['width'] / 2 , 0) | |
| elif sym_attr['align'] == 'r': | |
| # Right align | |
| align_matrix = psMat.translate(font_dim['width'] - sym_dim['width'], 0) | |
| else: | |
| # No alignment (left alignment) | |
| align_matrix = psMat.translate(0, 0) | |
| font.transform(align_matrix) | |
| if sym_attr['overlap'] is True: | |
| overlap_width = font.em / 48 | |
| # Stretch the glyph slightly horizontally if it should overlap | |
| font.transform(psMat.scale((sym_dim['width'] + overlap_width) / sym_dim['width'], 1)) | |
| if sym_attr['align'] == 'l': | |
| # The glyph should be left-aligned, so it must be moved overlap_width to the left | |
| # This only applies to left-aligned glyphs because the glyph is scaled to the right | |
| font.transform(psMat.translate(-overlap_width, 0)) | |
| # Ensure the font is considered monospaced on Windows | |
| font[sym_glyph.unicode].width = font_dim['width'] | |
| if font.bitmapSizes and not onlybitmaps: | |
| # If this is an outline font with bitmaps, regenerate bitmaps for the changed glyphs | |
| font.selection.changed() | |
| for size in font.bitmapSizes: | |
| font.regenBitmaps((size, )) | |
| output_name, extension = os.path.split(font_path)[1].rsplit('.', 1) | |
| if extension.lower() not in ['ttf', 'otf']: | |
| # Default to OpenType if input is not TrueType/OpenType | |
| extension = 'otf' | |
| if args.fixmono: | |
| for glyph in font.glyphs(): | |
| if glyph.width == 0: glyph.width = font_dim['width'] | |
| if onlybitmaps: | |
| # Generate BDF font | |
| font.generate('{0}-Powerline.bdf'.format(output_name, bitmap_type='bdf')) | |
| else: | |
| # Generate OTF/TTF font | |
| font.generate('{0}-Powerline.{1}'.format(output_name, extension)) | |
This file contains hidden or 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
| SplineFontDB: 3.0 | |
| FontName: PowerlineSymbols | |
| FullName: PowerlineSymbols | |
| FamilyName: PowerlineSymbols | |
| Weight: Medium | |
| Copyright: | |
| UComments: "2011-11-21: Created." | |
| Version: 001.000 | |
| ItalicAngle: 0 | |
| UnderlinePosition: -98.6328 | |
| UnderlineWidth: 48.8281 | |
| Ascent: 800 | |
| Descent: 200 | |
| LayerCount: 2 | |
| Layer: 0 0 "Back" 1 | |
| Layer: 1 0 "Fore" 0 | |
| XUID: [1021 211 26716215 11021609] | |
| FSType: 0 | |
| OS2Version: 0 | |
| OS2_WeightWidthSlopeOnly: 0 | |
| OS2_UseTypoMetrics: 1 | |
| CreationTime: 1321867751 | |
| ModificationTime: 1326665029 | |
| OS2TypoAscent: 0 | |
| OS2TypoAOffset: 1 | |
| OS2TypoDescent: 0 | |
| OS2TypoDOffset: 1 | |
| OS2TypoLinegap: 90 | |
| OS2WinAscent: 0 | |
| OS2WinAOffset: 1 | |
| OS2WinDescent: 0 | |
| OS2WinDOffset: 1 | |
| HheadAscent: 0 | |
| HheadAOffset: 1 | |
| HheadDescent: 0 | |
| HheadDOffset: 1 | |
| OS2Vendor: 'PfEd' | |
| MarkAttachClasses: 1 | |
| DEI: 91125 | |
| Encoding: UnicodeFull | |
| Compacted: 1 | |
| UnicodeInterp: none | |
| NameList: Adobe Glyph List | |
| DisplaySize: -24 | |
| AntiAlias: 1 | |
| FitToEm: 1 | |
| WinInfo: 0 31 18 | |
| BeginPrivate: 0 | |
| EndPrivate | |
| BeginChars: 1114112 9 | |
| StartChar: uni2B80 | |
| Encoding: 11136 11136 0 | |
| Width: 621 | |
| Flags: HMW | |
| LayerCount: 2 | |
| Fore | |
| SplineSet | |
| 0 1000 m 1 | |
| 621 379 l 1 | |
| 0 -243 l 1 | |
| 0 1000 l 1 | |
| EndSplineSet | |
| EndChar | |
| StartChar: uni2B81 | |
| Encoding: 11137 11137 1 | |
| Width: 621 | |
| Flags: HMW | |
| LayerCount: 2 | |
| Fore | |
| SplineSet | |
| 10 991 m 0 | |
| 16 997 23 1000 32 1000 c 0 | |
| 41 1000 48 996 54 990 c 2 | |
| 613 400 l 2 | |
| 619 394 621 386 621 378 c 0 | |
| 621 370 618 362 613 357 c 2 | |
| 54 -233 l 2 | |
| 48 -239 41 -242 32 -242 c 0 | |
| 23 -242 16 -240 10 -234 c 0 | |
| 4 -228 0 -221 0 -212 c 0 | |
| 0 -203 3 -196 8 -190 c 2 | |
| 547 379 l 1 | |
| 8 948 l 2 | |
| 3 954 0 961 0 970 c 0 | |
| 0 979 4 985 10 991 c 0 | |
| EndSplineSet | |
| EndChar | |
| StartChar: uni2B82 | |
| Encoding: 11138 11138 2 | |
| Width: 621 | |
| Flags: HMW | |
| LayerCount: 2 | |
| Fore | |
| SplineSet | |
| 621 1000 m 5 | |
| 621 -243 l 5 | |
| 0 379 l 5 | |
| 621 1000 l 5 | |
| EndSplineSet | |
| EndChar | |
| StartChar: uni2B83 | |
| Encoding: 11139 11139 3 | |
| Width: 621 | |
| Flags: HMW | |
| LayerCount: 2 | |
| Fore | |
| SplineSet | |
| 612 991 m 0 | |
| 618 985 621 979 621 970 c 0 | |
| 621 961 619 954 613 948 c 2 | |
| 74 379 l 1 | |
| 613 -190 l 2 | |
| 619 -196 621 -203 621 -212 c 0 | |
| 621 -221 618 -228 612 -234 c 0 | |
| 606 -240 598 -242 589 -242 c 0 | |
| 580 -242 574 -239 568 -233 c 2 | |
| 8 357 l 2 | |
| 3 362 0 370 0 378 c 0 | |
| 0 386 3 394 8 400 c 2 | |
| 568 990 l 2 | |
| 574 996 580 1000 589 1000 c 0 | |
| 598 1000 606 997 612 991 c 0 | |
| EndSplineSet | |
| EndChar | |
| StartChar: uni2B61 | |
| Encoding: 11105 11105 4 | |
| Width: 555 | |
| VWidth: 0 | |
| Flags: HMW | |
| LayerCount: 2 | |
| Fore | |
| SplineSet | |
| 0 800 m 5 | |
| 92 800 l 5 | |
| 92 513 l 5 | |
| 253 513 l 5 | |
| 253 444 l 5 | |
| 0 444 l 5 | |
| 0 800 l 5 | |
| 236 312 m 5 | |
| 339 312 l 5 | |
| 468 67 l 5 | |
| 468 312 l 5 | |
| 555 312 l 5 | |
| 555 -44 l 5 | |
| 453 -44 l 5 | |
| 323 200 l 5 | |
| 323 -44 l 5 | |
| 236 -44 l 5 | |
| 236 312 l 5 | |
| EndSplineSet | |
| EndChar | |
| StartChar: uni2B60 | |
| Encoding: 11104 11104 5 | |
| Width: 676 | |
| Flags: HMW | |
| LayerCount: 2 | |
| Fore | |
| SplineSet | |
| 0 197 m 1 | |
| 94 207 419 279 419 384 c 2 | |
| 419 537 l 1 | |
| 278 501 l 1 | |
| 478 794 l 1 | |
| 677 501 l 1 | |
| 536 537 l 1 | |
| 536 384 l 2 | |
| 536 196 208 126 208 21 c 2 | |
| 208 -244 l 1 | |
| 0 -244 l 1 | |
| 0 197 l 1 | |
| 0 288 m 1 | |
| 0 405 0 944 0 944 c 1 | |
| 208 944 l 1 | |
| 208 944 208 451 208 334 c 1 | |
| 185 311 12 288 0 288 c 1 | |
| EndSplineSet | |
| EndChar | |
| StartChar: uni2B62 | |
| Encoding: 11106 11106 6 | |
| Width: 428 | |
| VWidth: 0 | |
| Flags: HMW | |
| LayerCount: 2 | |
| Fore | |
| SplineSet | |
| 88 677 m 2 | |
| 429 677 l 1 | |
| 429 589 l 1 | |
| 88 589 l 1 | |
| 88 162 l 1 | |
| 198 162 l 1 | |
| 198 343 l 1 | |
| 374 343 l 1 | |
| 374 427 l 1 | |
| 198 427 l 1 | |
| 198 506 l 1 | |
| 429 506 l 1 | |
| 429 274 l 1 | |
| 416 263 391 255 374 255 c 2 | |
| 286 255 l 1 | |
| 286 162 l 2 | |
| 286 114 246 74 198 74 c 2 | |
| 88 74 l 2 | |
| 40 74 0 114 0 162 c 2 | |
| 0 589 l 2 | |
| 0 637 40 677 88 677 c 2 | |
| EndSplineSet | |
| EndChar | |
| StartChar: uni2B63 | |
| Encoding: 11107 11107 7 | |
| Width: 428 | |
| VWidth: 0 | |
| Flags: HMW | |
| LayerCount: 2 | |
| Fore | |
| SplineSet | |
| 0 677 m 5 | |
| 341 677 l 6 | |
| 389 677 429 637 429 589 c 6 | |
| 429 506 l 6 | |
| 429 458 389 418 341 418 c 6 | |
| 287 418 l 5 | |
| 287 162 l 6 | |
| 287 114 247 74 199 74 c 6 | |
| 89 74 l 6 | |
| 41 74 1 114 1 162 c 6 | |
| 1 274 l 6 | |
| 0 274 l 6 | |
| 0 506 l 5 | |
| 89 506 l 5 | |
| 89 162 l 5 | |
| 199 162 l 5 | |
| 199 506 l 5 | |
| 341 506 l 5 | |
| 341 589 l 5 | |
| 0 589 l 5 | |
| 0 677 l 5 | |
| EndSplineSet | |
| EndChar | |
| StartChar: uni2B64 | |
| Encoding: 11108 11108 8 | |
| Width: 546 | |
| VWidth: 0 | |
| Flags: HMW | |
| LayerCount: 2 | |
| Fore | |
| SplineSet | |
| 273 733 m 4 | |
| 429 733 430 538 430 538 c 5 | |
| 430 420 l 5 | |
| 547 420 l 5 | |
| 547 303 l 5 | |
| 547 303 546 -9 273 -9 c 4 | |
| 0 -9 0 303 0 303 c 5 | |
| 0 420 l 5 | |
| 117 420 l 5 | |
| 117 538 l 5 | |
| 117 538 117 733 273 733 c 4 | |
| 273 655 m 4 | |
| 195 655 195 576 195 420 c 5 | |
| 352 420 l 5 | |
| 352 576 351 655 273 655 c 4 | |
| 273 342 m 4 | |
| 195 342 195 147 273 147 c 4 | |
| 351 147 351 342 273 342 c 4 | |
| EndSplineSet | |
| EndChar | |
| EndChars | |
| BitmapFont: 10 10 8 2 1 | |
| BDFChar: 0 11136 6 0 4 -2 7 | |
| JAC+4q"X@:^jlCb | |
| BDFChar: 1 11137 6 0 4 -2 7 | |
| J3Y4g#RCta5_&h7 | |
| BDFChar: 2 11138 6 1 5 -2 7 | |
| #T,OGq"T(n(^L*A | |
| BDFChar: 3 11139 6 1 5 -2 7 | |
| #S8+DJ:Km-&-r79 | |
| BDFChar: 4 11105 6 1 4 -1 7 | |
| J:N1>!0GR3O8o7\ | |
| BDFChar: 5 11104 7 0 5 -2 7 | |
| ^rY<PaN2`d^q]pM | |
| BDFChar: 6 11106 4 1 5 -1 6 | |
| G^u0KJ=)F+ | |
| BDFChar: 7 11107 4 0 5 -1 6 | |
| p]QtGOH>Q3 | |
| BDFChar: 8 11108 5 0 5 0 6 | |
| 0M"b4bku\c | |
| EndBitmapFont | |
| BitmapFont: 12 10 10 2 1 | |
| BDFChar: 0 11136 7 0 6 -2 11 | |
| !!%Pbi:-O>r:od>^jlCb | |
| BDFChar: 1 11137 7 0 6 -3 11 | |
| !!%O7+:ne]":,P]5_&h7 | |
| BDFChar: 2 11138 7 0 6 -2 11 | |
| !!!-1*'AWHr-UUH$j6P1 | |
| BDFChar: 3 11139 7 0 6 -2 11 | |
| !!!--&0O5gJ3Y4g#Qt,- | |
| BDFChar: 4 11105 7 0 5 0 8 | |
| J:N1>!$jBP,QIfE | |
| BDFChar: 5 11104 8 0 8 -3 11 | |
| z^];.Ma8juqa8j9]a8jQehuLOm^];.Mz | |
| BDFChar: 6 11106 5 1 6 0 8 | |
| !-j$]R"1Qc?iU0, | |
| BDFChar: 7 11107 5 0 5 0 7 | |
| p]QtGOH>Q3 | |
| BDFChar: 8 11108 7 0 5 0 8 | |
| 0M"`*r63C_GQ7^D | |
| EndBitmapFont | |
| EndSplineFont |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment