Package pycocoa :: Module fonts
[frames] | no frames]

Module fonts

Type Font, etc., wrapping ObjC NSFont.


Version: 20.11.18

Classes
  Font
Python Font Type, wrapping ObjC NSFont.
  FontError
Font selection error.
  FontTraitError
Font traits error.
Functions
 
fontfamilies(*prefixes)
Yield the installed font families.
 
fontnamesof(family)
Yield the available font names of a family.
 
fontsof(family, size=0, weight=None)
Yield the available fonts of a family.
 
fontsof4(family)
Yield the available fonts of a family.
 
fontTraits(*traits)
Return a font traits mask for the named traits.
 
fontTraitstrs(traits)
Return font traits as names.
Variables
  __all__ = _ALL_LAZY.fonts
  FontTrait = FontTrait.Bold...
Font trait constants (mask).
  Fonts = Fonts.App=Font({family='Helvetica', name='Helvetica', ...
Pre-defined system fonts, all Font instances.
  FontTrait.Bold
int(x=0) -> int or long.
  FontTrait.Compressed
int(x=0) -> int or long.
  FontTrait.Condensed
int(x=0) -> int or long.
  FontTrait.Expanded
int(x=0) -> int or long.
  FontTrait.Italic
int(x=0) -> int or long.
  FontTrait.MonoSpace
int(x=0) -> int or long.
  FontTrait.Narrow
int(x=0) -> int or long.
  FontTrait.Poster
int(x=0) -> int or long.
  FontTrait.SansSerif
int(x=0) -> int or long.
  FontTrait.SmallCaps
int(x=0) -> int or long.
  FontTrait.UnBold
int(x=0) -> int or long.
  FontTrait.UnItalic
int(x=0) -> int or long.
  Fonts.App
Get the UserFont.
  Fonts.Bold
Get the BoldFont.
  Fonts.BoldItalic
Get the BoldItalicFont.
  Fonts.Italic
Get the ItalicFont.
  Fonts.Label
Get the LabelFont.
  Fonts.Menu
Get the MenuFont.
  Fonts.MenuBar
Get the MenuBarFont.
  Fonts.Message
Get the MessageFont.
  Fonts.MonoSpace
Get the MonoSpaceFont.
  Fonts.Palette
Get the PaletteFont.
  Fonts.System
Get the SystemFont.
  Fonts.TableData
Get the TableDataFont.
  Fonts.TableHeader
Get the TableHeaderFont.
  Fonts.Title
Get the TitleFont.
Function Details

fontfamilies(*prefixes)

 

Yield the installed font families.

Parameters:
  • prefixes - No, one or more font family names to match (str-s).
Returns:
Each font family name (str).

fontnamesof(family)

 

Yield the available font names of a family.

Parameters:
  • family - Generic font name (str), like "Times" or "Helvetica".
Returns:
The name (str) of each font.

fontsof(family, size=0, weight=None)

 

Yield the available fonts of a family.

Parameters:
  • family - Generic font name (str), like "Times" or "Helvetica".
  • size - The point size (int), zero for any.
  • weight - The book weight (int), None for any.
Returns:
A (Font) instance for each font.
Raises:
  • ValueError - Invalid weight.

fontsof4(family)

 

Yield the available fonts of a family.

Parameters:
  • family - Generic font name (str), like "Times" or "Helvetica".
Returns:
4-Tuple (name, attributes, weight, traits) of (str, str, int, int) for each font.

fontTraits(*traits)

 

Return a font traits mask for the named traits.

Parameters:
  • traits - Trait names (strs), case-insensitive.
Returns:
Combined traits (FontTraits mask).
Raises:

fontTraitstrs(traits)

 

Return font traits as names.

Parameters:
  • traits - Traits (FontTraits mask).
Returns:
Tuple of trait names (strs).

Variables Details

FontTrait

Font trait constants (mask).
Value:
FontTrait.Bold=2,
         .Compressed=1<<9,
         .Condensed=1<<6,
         .Expanded=1<<5,
         .Italic=1,
         .MonoSpace=1<<10,
         .Narrow=1<<4,
         .Poster=1<<8,
...

Fonts

Pre-defined system fonts, all Font instances.
Value:
Fonts.App=Font({family='Helvetica', name='Helvetica', size=12, weight=\
5}),
     .Bold=Font({family='.AppleSystemUIFont', name='.AppleSystemUIFont\
Bold', size=13, traits='Bold', weight=9}),
     .BoldItalic=Font({family='.AppleSystemUIFont', name='.AppleSystem\
UIFontEmphasizedItalic', size=13, traits='Bold Italic', weight=9}),
     .Italic=Font({family='.AppleSystemUIFont', name='.AppleSystemUIFo\
ntItalic', size=13, traits='Italic', weight=5}),
...