def set(self, options): if options is None: options = dict() updateWithDefaultValues(options, defaultOptions) self.hintRangeMinimum.set(options["hintRangeMinimum"]) self.hintRangeMaximum.set(options["hintRangeMaximum"]) self.hintingLimit.set(options["hintingLimit"]) self.noHintingLimit.set(options["noHintingLimit"]) self.noHintingLimitCallback(self.noHintingLimit) self.xHeightIncreaseLimit.set(options["xHeightIncreaseLimit"]) self.noXHeightIncreaseLimit.set(options["noXHeightIncreaseLimit"]) self.noXHeightIncreaseLimitCallback(self.noXHeightIncreaseLimit) self.fallbackScript.set(options["fallbackScript"]) self.preHinting.set(options["preHinting"]) self.symbolFont.set(options["symbolFont"]) self.addTTFAutoHintInfo.set(options["addTTFAutoHintInfo"]) self.overRideFontLicense.set(options["overRideFontLicense"]) self.grayScale.set(options["grayScale"]) self.gdiClearType.set(options["gdiClearType"]) self.dwClearType.set(options["dwClearType"])
def set(self, options): if options is None: options = dict() updateWithDefaultValues(options, defaultOptions) self.hintRangeMinimum.set(options["hintRangeMinimum"]) self.hintRangeMaximum.set(options["hintRangeMaximum"]) self.hintingLimit.set(options["hintingLimit"]) self.noHintingLimit.set(options["noHintingLimit"]) self.noHintingLimitCallback(self.noHintingLimit) self.xHeightIncreaseLimit.set(options["xHeightIncreaseLimit"]) self.noXHeightIncreaseLimit.set(options["noXHeightIncreaseLimit"]) self.noXHeightIncreaseLimitCallback(self.noXHeightIncreaseLimit) self.fallbackScript.set(options["fallbackScript"]) self.preHinting.set(options["preHinting"]) self.symbolFont.set(options["symbolFont"]) self.addTTFAutoHintInfo.set(options["addTTFAutoHintInfo"]) self.overRideFontLicense.set(options["overRideFontLicense"]) self.grayScale.set(options["grayScale"]) self.gdiClearType.set(options["gdiClearType"]) self.dwClearType.set(options["dwClearType"])
def __init__(self, parentWindow): data = getExtensionDefault(self.identifier, dict()) updateWithDefaultValues(data, defaultOptions) width = 380 height = 1000 self.w = Sheet((width, height), parentWindow=parentWindow) y = 10 self.w.threaded = CheckBox((10, y, -10, 22), "Threaded", value=data["threaded"]) y += 30 self.w.exportInFolders = CheckBox((10, y, -10, 22), "Export in Sub Folders", value=data["exportInFolders"]) y += 30 self.w.keepFileNames = CheckBox((10, y, -10, 22), "Keep file names (otherwise use familyName-styleName)", value=data["keepFileNames"]) y += 35 self.w.saveButton = Button((-100, y, -10, 20), "Save settings", callback=self.saveCallback, sizeStyle="small") self.w.setDefaultButton(self.w.saveButton) self.w.closeButton = Button((-190, y, -110, 20), "Cancel", callback=self.closeCallback, sizeStyle="small") self.w.closeButton.bind(".", ["command"]) self.w.closeButton.bind(unichr(27), []) self.w.resetButton = Button((-280, y, -200, 20), "Reset", callback=self.resetCallback, sizeStyle="small") y += 30 self.w.resize(width, y, False) self.w.open()
def __init__(self, posSize): super(TTFAutoHintGroup, self).__init__(posSize) self.getNSView().setFrame_((((0, 0), (400, 400)))) self.options = dict() updateWithDefaultValues(self.options, defaultOptions) column = 180 gutter = 15 y = 10 self.hintRangeMininmumText = vanilla.TextBox((10, y+2, column, 22), "Hint Set Range Minimum:", alignment="right") self.hintRangeMinimum = SliderEditStepper((column + gutter, y, -10, 22), self.options["hintRangeMinimum"], callback=self.hintRangeMinimumMaximumCallback) y += 32 self.hintRangeMaximumText = vanilla.TextBox((10, y+2, column, 22), "Hint Set Range Maximum:", alignment="right") self.hintRangeMaximum = SliderEditStepper((column + gutter, y, -10, 22), self.options["hintRangeMaximum"], callback=self.hintRangeMinimumMaximumCallback) y += 42 self.hintingLimitText = vanilla.TextBox((10, y+2, column, 22), "Hinting Limit:", alignment="right") self.hintingLimit = SliderEditStepper((column + gutter, y, -10, 22), self.options["hintingLimit"]) y += 22 self.noHintingLimit = vanilla.CheckBox((column + gutter, y, -10, 22), "No Hinting Limit", callback=self.noHintingLimitCallback, sizeStyle="small") y += 32 self.xHeightIncreaseLimitText = vanilla.TextBox((10, y+2, column, 22), "X Height Increase Limit:", alignment="right") self.xHeightIncreaseLimit = SliderEditStepper((column + gutter, y, -10, 22), self.options["xHeightIncreaseLimit"]) y += 32 self.noXHeightIncreaseLimit = vanilla.CheckBox((column + gutter, y, -10, 22), "No X Height Increase Limit", callback=self.noXHeightIncreaseLimitCallback, sizeStyle="small") y += 32 self.fallbackScript = vanilla.CheckBox((column + gutter, y, -10, 22), "Fallback Script (Latin)", value=self.options["fallbackScript"]) y += 22 self.preHinting = vanilla.CheckBox((column + gutter, y, -10, 22), "Pre Hinted", value=self.options["preHinting"]) y += 22 self.symbolFont = vanilla.CheckBox((column + gutter, y, -10, 22), "Symbol Font", value=self.options["symbolFont"]) y += 22 self.addTTFAutoHintInfo = vanilla.CheckBox((column + gutter, y, -10, 22), "Add ttfautohint Info", value=self.options["addTTFAutoHintInfo"]) y += 22 self.overRideFontLicense = vanilla.CheckBox((column + gutter, y, -10, 22), "Override Font License Restrictions", value=self.options["overRideFontLicense"]) y += 32 self.stemWidthAndStemPos = vanilla.TextBox((0, y, column+10, 22), "Stem Width and Positioning:", alignment="right") self.grayScale = vanilla.CheckBox((column + gutter, y, -10, 22), "Gray Scale", value=self.options["grayScale"]) y += 22 self.gdiClearType = vanilla.CheckBox((column + gutter, y, -10, 22), "GDI ClearType", value=self.options["gdiClearType"]) y += 22 self.dwClearType = vanilla.CheckBox((column + gutter, y, -10, 22), "DW ClearType", value=self.options["dwClearType"])
def __init__(self, parentWindow): data = getExtensionDefault(self.identifier, dict()) updateWithDefaultValues(data, defaultOptions) data["debug"] = getDefault("Batch.Debug", False) width = 380 height = 1000 self.w = Sheet((width, height), parentWindow=parentWindow) y = 10 self.w.threaded = CheckBox((10, y, -10, 22), "Threaded", value=data["threaded"]) y += 30 self.w.exportInFolders = CheckBox((10, y, -10, 22), "Export in Sub Folders", value=data["exportInFolders"]) y += 30 self.w.keepFileNames = CheckBox( (10, y, -10, 22), "Keep file names (otherwise use familyName-styleName)", value=data["keepFileNames"]) y += 30 self.w.debug = CheckBox((10, y, -10, 22), "Debug", value=data["debug"]) y += 35 self.w.saveButton = Button((-100, y, -10, 20), "Save settings", callback=self.saveCallback, sizeStyle="small") self.w.setDefaultButton(self.w.saveButton) self.w.closeButton = Button((-190, y, -110, 20), "Cancel", callback=self.closeCallback, sizeStyle="small") self.w.closeButton.bind(".", ["command"]) self.w.closeButton.bind(chr(27), []) self.w.resetButton = Button((-280, y, -200, 20), "Reset", callback=self.resetCallback, sizeStyle="small") y += 30 self.w.resize(width, y, False) self.w.open()
def TTFAutohint(sourcePath, destinationPath, options=dict()): """ Options: --debug print debugging information -f, --latin-fallback set fallback script to latin -G, --hinting-limit=N switch off hinting above this PPEM value (default: 200); value 0 means no limit -h, --help display this help and exit -i, --ignore-restrictions override font license restrictions -l, --hinting-range-min=N the minimum PPEM value for hint sets (default: 8) -n --no-info don't add ttfautohint info to the version string(s) in the `name' table -p, --pre-hinting apply original hints in advance -r, --hinting-range-max=N the maximum PPEM value for hint sets (default: 50) -s, --symbol input is symbol font -v, --verbose show progress information -V, --version print version information and exit -w, --strong-stem-width=S use strong stem width routine for modes S, where S is a string of up to three letters with possible values `g' for grayscale, `G' for GDI ClearType, and `D' for DirectWrite ClearType (default: G) -x, --increase-x-height=N increase x height for sizes in the range 6<=PPEM<=N; value 0 switches off this feature (default: 14) -X, --x-height-snapping-exceptions=STRING specify a comma-separated list of x-height snapping exceptions """ updateWithDefaultValues(options, defaultOptions) hintRangeMinimum = str(options["hintRangeMinimum"]) hintRangeMaximum = str(options["hintRangeMaximum"]) fallbackScript = options["fallbackScript"] hintingLimit = options["hintingLimit"] noHintingLimit = options["noHintingLimit"] if noHintingLimit: hintingLimit = 0 hintingLimit = str(hintingLimit) xHeightIncreaseLimit = options["xHeightIncreaseLimit"] noXHeightIncreaseLimit = options["noXHeightIncreaseLimit"] if noXHeightIncreaseLimit: xHeightIncreaseLimit = 0 xHeightIncreaseLimit = str(xHeightIncreaseLimit) preHinting = options["preHinting"] symbolFont = options["symbolFont"] if not symbolFont: f = TTFont(sourcePath) symbolFont = "o" not in f.getGlyphOrder() f.close() addTTFAutoHintInfo = options["addTTFAutoHintInfo"] overRideFontLicense = options["overRideFontLicense"] grayScale = options["grayScale"] if grayScale: grayScale = "g" else: grayScale = "" gdiClearType = options["gdiClearType"] if gdiClearType: gdiClearType = "G" else: gdiClearType = "" dwClearType = options["dwClearType"] if dwClearType: dwClearType = "D" else: dwClearType = "" cmd = [ttfautohint] cmd.extend(["-G", hintingLimit]) cmd.extend(["-l", hintRangeMinimum]) cmd.extend(["-r", hintRangeMaximum]) cmd.extend(["-x", xHeightIncreaseLimit]) if fallbackScript: cmd.append("-f") if not addTTFAutoHintInfo: cmd.append("-n") if preHinting: cmd.append("-p") if symbolFont: cmd.append("-s") if not overRideFontLicense: cmd.append("-i") cmd.extend(["-w", grayScale + gdiClearType + dwClearType]) cmd.extend([sourcePath, destinationPath]) result = executeCommand(cmd) return result
def TTFAutohint(sourcePath, destinationPath, options=dict()): """ Options: --debug print debugging information -f, --latin-fallback set fallback script to latin -G, --hinting-limit=N switch off hinting above this PPEM value (default: 200); value 0 means no limit -h, --help display this help and exit -i, --ignore-restrictions override font license restrictions -l, --hinting-range-min=N the minimum PPEM value for hint sets (default: 8) -n --no-info don't add ttfautohint info to the version string(s) in the `name' table -p, --pre-hinting apply original hints in advance -r, --hinting-range-max=N the maximum PPEM value for hint sets (default: 50) -s, --symbol input is symbol font -v, --verbose show progress information -V, --version print version information and exit -w, --strong-stem-width=S use strong stem width routine for modes S, where S is a string of up to three letters with possible values `g' for grayscale, `G' for GDI ClearType, and `D' for DirectWrite ClearType (default: G) -x, --increase-x-height=N increase x height for sizes in the range 6<=PPEM<=N; value 0 switches off this feature (default: 14) -X, --x-height-snapping-exceptions=STRING specify a comma-separated list of x-height snapping exceptions """ updateWithDefaultValues(options, defaultOptions) hintRangeMinimum = str(options["hintRangeMinimum"]) hintRangeMaximum = str(options["hintRangeMaximum"]) fallbackScript = options["fallbackScript"] hintingLimit = options["hintingLimit"] noHintingLimit = options["noHintingLimit"] if noHintingLimit: hintingLimit = 0 hintingLimit = str(hintingLimit) xHeightIncreaseLimit = options["xHeightIncreaseLimit"] noXHeightIncreaseLimit = options["noXHeightIncreaseLimit"] if noXHeightIncreaseLimit: xHeightIncreaseLimit = 0 xHeightIncreaseLimit = str(xHeightIncreaseLimit) preHinting = options["preHinting"] symbolFont = options["symbolFont"] if not symbolFont: f = TTFont(sourcePath) symbolFont = "o" not in f.getGlyphOrder() f.close() addTTFAutoHintInfo = options["addTTFAutoHintInfo"] overRideFontLicense = options["overRideFontLicense"] grayScale = options["grayScale"] if grayScale: grayScale = "g" else: grayScale = "" gdiClearType = options["gdiClearType"] if gdiClearType: gdiClearType = "G" else: gdiClearType = "" dwClearType = options["dwClearType"] if dwClearType: dwClearType = "D" else: dwClearType = "" cmd = [ttfautohint] cmd.extend(["-G", hintingLimit]) cmd.extend(["-l", hintRangeMinimum]) cmd.extend(["-r", hintRangeMaximum]) cmd.extend(["-x", xHeightIncreaseLimit]) if fallbackScript: cmd.append("-f") if not addTTFAutoHintInfo: cmd.append("-n") if preHinting: cmd.append("-p") if symbolFont: cmd.append("-s") if not overRideFontLicense: cmd.append("-i") cmd.extend(["-w", grayScale + gdiClearType + dwClearType]) cmd.extend([sourcePath, destinationPath]) result = executeCommand(cmd) return result
def __init__(self, posSize): super(TTFAutoHintGroup, self).__init__(posSize) self.getNSView().setFrame_((((0, 0), (400, 400)))) self.options = dict() updateWithDefaultValues(self.options, defaultOptions) column = 180 gutter = 15 y = 10 self.hintRangeMininmumText = vanilla.TextBox((10, y+2, column, 22), "Hint Set Range Minimum:", alignment="right") self.hintRangeMinimum = SliderEditIntStepper((column + gutter, y, -10, 22), self.options["hintRangeMinimum"], callback=self.hintRangeMinimumMaximumCallback) y += 30 self.hintRangeMaximumText = vanilla.TextBox((10, y+2, column, 22), "Hint Set Range Maximum:", alignment="right") self.hintRangeMaximum = SliderEditIntStepper((column + gutter, y, -10, 22), self.options["hintRangeMaximum"], callback=self.hintRangeMinimumMaximumCallback) y += 50 self.hintingLimitText = vanilla.TextBox((10, y+2, column, 22), "Hinting Limit:", alignment="right") self.hintingLimit = SliderEditIntStepper((column + gutter, y, -10, 22), self.options["hintingLimit"]) y += 28 self.noHintingLimit = vanilla.CheckBox((column + gutter, y, -10, 22), "No Hinting Limit", callback=self.noHintingLimitCallback, sizeStyle="small") y += 30 self.xHeightIncreaseLimitText = vanilla.TextBox((10, y+2, column, 22), "X Height Increase Limit:", alignment="right") self.xHeightIncreaseLimit = SliderEditIntStepper((column + gutter, y, -10, 22), self.options["xHeightIncreaseLimit"]) y += 28 self.noXHeightIncreaseLimit = vanilla.CheckBox((column + gutter, y, -10, 22), "No X Height Increase Limit", callback=self.noXHeightIncreaseLimitCallback, sizeStyle="small") y += 50 self.fallbackScript = vanilla.CheckBox((column + gutter, y, -10, 22), "Fallback Script (Latin)", value=self.options["fallbackScript"]) y += 50 self.preHinting = vanilla.CheckBox((column + gutter, y, -10, 22), "Pre Hinted", value=self.options["preHinting"]) y += 30 self.symbolFont = vanilla.CheckBox((column + gutter, y, -10, 22), "Symbol Font", value=self.options["symbolFont"]) y += 30 self.addTTFAutoHintInfo = vanilla.CheckBox((column + gutter, y, -10, 22), "Add ttfautohint Info", value=self.options["addTTFAutoHintInfo"]) y += 30 self.overRideFontLicense = vanilla.CheckBox((column + gutter, y, -10, 22), "Override Font License Restrictions", value=self.options["overRideFontLicense"]) y += 50 self.stemWidthAndStemPos = vanilla.TextBox((0, y, column+10, 22), "Stem Width and Positioning:", alignment="right") self.grayScale = vanilla.CheckBox((column + gutter, y, -10, 22), "Gray Scale", value=self.options["grayScale"]) y += 30 self.gdiClearType = vanilla.CheckBox((column + gutter, y, -10, 22), "GDI ClearType", value=self.options["gdiClearType"]) y += 30 self.dwClearType = vanilla.CheckBox((column + gutter, y, -10, 22), "DW ClearType", value=self.options["dwClearType"])