FcPattern.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 06 Sep 2017 09:47:50 +0200
branchjv
changeset 8179 ced410b68993
parent 7154 f2d585b5f20e
child 8420 76e39223f5ab
permissions -rw-r--r--
Build files: fixed project definition ...so it passes the package validation.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7150
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
"{ Package: 'stx:libview' }"
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     2
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
"{ NameSpace: Smalltalk }"
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     4
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
ExternalAddress subclass:#FcPattern
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     6
	instanceVariableNames:''
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     7
	classVariableNames:''
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
	poolDictionaries:'FcConstants'
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
	category:'Graphics-Support-FontConfig'
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
!
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    11
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
!FcPattern primitiveDefinitions!
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
%{
7154
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
    14
#ifdef HAVE_FONTCONFIG
7150
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
/*
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
 * includes, defines, structure definitions
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    17
 * and typedefs come here.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    18
 */
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
#undef FcPattern
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
#undef True
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
#undef False
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    22
#undef Time
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
#include <stdlib.h>
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    25
#include <fontconfig/fontconfig.h>
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
#define FC_PATTERN_VAL(x) ((FcPattern*)__externalAddressVal(x))
7154
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
    28
#endif
7150
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
%}
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    30
! !
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    31
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    32
!FcPattern class methodsFor:'documentation'!
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    33
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    34
documentation
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    35
"
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    36
    See https://www.freedesktop.org/software/fontconfig/fontconfig-devel/x19.html
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    37
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    38
    FONT PROPERTIES
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    39
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    40
    While font patterns may contain essentially any properties, there are some 
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    41
    well known properties with associated types. Fontconfig uses some of these 
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    42
    properties for font matching and font completion. Others are provided as a 
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    43
    convenience for the application's rendering mechanism.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    44
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    45
    Property       C Preprocessor Symbol  Type    Description
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    46
    ----------------------------------------------------
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    47
    family         FC_FAMILY              String  Font family names
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    48
    familylang     FC_FAMILYLANG          String  Language corresponding to
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    49
                                                  each family name
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    50
    style          FC_STYLE               String  Font style. Overrides weight
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    51
                                                  and slant
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    52
    stylelang      FC_STYLELANG           String  Language corresponding to
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    53
                                                  each style name
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    54
    fullname       FC_FULLNAME            String  Font face full name where
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    55
                                                  different from family and
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    56
                                                  family + style
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    57
    fullnamelang   FC_FULLNAMELANG        String  Language corresponding to
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    58
                                                  each fullname
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    59
    slant          FC_SLANT               Int     Italic, oblique or roman
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    60
    weight         FC_WEIGHT              Int     Light, medium, demibold,
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    61
                                                  bold or black
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    62
    size           FC_SIZE                Double  Point size
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    63
    width          FC_WIDTH               Int     Condensed, normal or expanded
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    64
    aspect         FC_ASPECT              Double  Stretches glyphs horizontally
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    65
                                                  before hinting
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    66
    pixelsize      FC_PIXEL_SIZE          Double  Pixel size
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    67
    spacing        FC_SPACING             Int     Proportional, dual-width,
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    68
                                                  monospace or charcell
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    69
    foundry        FC_FOUNDRY             String  Font foundry name
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    70
    antialias      FC_ANTIALIAS           Bool    Whether glyphs can be
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    71
                                                  antialiased
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    72
    hinting        FC_HINTING             Bool    Whether the rasterizer should
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    73
                                                  use hinting
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    74
    hintstyle      FC_HINT_STYLE          Int     Automatic hinting style
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    75
    verticallayout FC_VERTICAL_LAYOUT     Bool    Use vertical layout
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    76
    autohint       FC_AUTOHINT            Bool    Use autohinter instead of
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    77
                                                  normal hinter
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    78
    globaladvance  FC_GLOBAL_ADVANCE      Bool    Use font global advance data (deprecated)
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    79
    file           FC_FILE                String  The filename holding the font
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    80
    index          FC_INDEX               Int     The index of the font within
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    81
                                                  the file
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    82
    ftface         FC_FT_FACE             FT_Face Use the specified FreeType
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    83
                                                  face object
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    84
    rasterizer     FC_RASTERIZER          String  Which rasterizer is in use (deprecated)
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    85
    outline        FC_OUTLINE             Bool    Whether the glyphs are outlines
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    86
    scalable       FC_SCALABLE            Bool    Whether glyphs can be scaled
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    87
    scale          FC_SCALE               Double  Scale factor for point->pixel
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    88
                                                  conversions (deprecated)
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    89
    symbol         FC_SYMBOL              Bool    Whether font uses MS symbol-font encoding
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    90
    color          FC_COLOR               Bool    Whether any glyphs have color
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    91
    dpi            FC_DPI                 Double  Target dots per inch
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    92
    rgba           FC_RGBA                Int     unknown, rgb, bgr, vrgb,
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    93
                                                  vbgr, none - subpixel geometry
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    94
    lcdfilter      FC_LCD_FILTER          Int     Type of LCD filter
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    95
    minspace       FC_MINSPACE            Bool    Eliminate leading from line
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    96
                                                  spacing
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    97
    charset        FC_CHARSET             CharSet Unicode chars encoded by
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    98
                                                  the font
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    99
    lang           FC_LANG                LangSet Set of RFC-3066-style
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   100
                                                  languages this font supports
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   101
    fontversion    FC_FONTVERSION         Int     Version number of the font
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   102
    capability     FC_CAPABILITY          String  List of layout capabilities in
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   103
                                                  the font
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   104
    fontformat     FC_FONTFORMAT          String  String name of the font format
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   105
    embolden       FC_EMBOLDEN            Bool    Rasterizer should
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   106
                                                  synthetically embolden the font
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   107
    embeddedbitmap FC_EMBEDDED_BITMAP     Bool    Use the embedded bitmap instead
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   108
                                                  of the outline
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   109
    decorative     FC_DECORATIVE          Bool    Whether the style is a decorative
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   110
                                                  variant
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   111
    fontfeatures   FC_FONT_FEATURES       String  List of extra feature tags in
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   112
                                                  OpenType to be enabled
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   113
    namelang       FC_NAMELANG            String  Language name to be used for the
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   114
                                                  default value of familylang,
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   115
                                                  stylelang and fullnamelang
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   116
    prgname        FC_PRGNAME             String  Name of the running program
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   117
    hash           FC_HASH                String  SHA256 hash value of the font data
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   118
                                                  with 'sha256:' prefix (deprecated)
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   119
    postscriptname FC_POSTSCRIPT_NAME     String  Font name in PostScript
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   120
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   121
    [author:]
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   122
        Jan Vrany <jan.vrany@fit.cvut.cz>
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   123
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   124
    [instance variables:]
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   125
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   126
    [class variables:]
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   127
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   128
    [see also:]
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   129
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   130
"
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   131
! !
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   132
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   133
!FcPattern class methodsFor:'initialization'!
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   134
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   135
initialize
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   136
    
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   137
    "Created: / 17-02-2016 / 17:18:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   138
! !
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   139
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   140
!FcPattern class methodsFor:'instance creation'!
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   141
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   142
fromFontDescription: aFontDescription
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   143
    | family size psize weight slant pattern |
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   144
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   145
    family := aFontDescription family.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   146
    size := aFontDescription size.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   147
    psize := aFontDescription pixelSize.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   148
    weight := (StXFace2FCWeightMap at: (aFontDescription face ? 'regular')).
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   149
    slant := (StXStyle2FCSlantMap at: (aFontDescription style ? 'roman') ifAbsent:[StXStyle2FCSlantMap at: (aFontDescription style ? 'roman') asLowercase]).
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   150
    pattern := self new.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   151
    pattern at: FC_FAMILY  put: family.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   152
    psize notNil ifTrue:[
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   153
       pattern at: FC_PIXEL_SIZE put: psize.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   154
   ] ifFalse:[
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   155
       pattern at: FC_SIZE put: size.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   156
   ].
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   157
   pattern at: FC_WEIGHT put: weight.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   158
   pattern at: FC_SLANT put: slant.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   159
 
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   160
    ^ pattern
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   161
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   162
    "
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   163
    FcPattern fromFontDescription: SimpleView defaultFont
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   164
    FcPattern fromFontDescription: CodeView defaultFont
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   165
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   166
    "
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   167
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   168
    "Created: / 17-02-2016 / 17:19:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   169
!
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   170
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   171
fromString: aString
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   172
    ^self basicNew initializeFromString: aString
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   173
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   174
!
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   175
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   176
new
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   177
    ^self basicNew initialize
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   178
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   179
! !
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   180
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   181
!FcPattern methodsFor:'accessing'!
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   182
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   183
at: attribute
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   184
    "Return  a value of the specified pattern element. If there are multiple values,
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   185
     return them as an OrderedCollection. Throw an error if `attribute` does not exist"
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   186
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   187
    ^ self at: attribute ifAbsent:[ self errorKeyNotFound: attribute ]
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   188
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   189
    "Created: / 17-02-2016 / 14:33:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   190
!
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   191
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   192
at: attribute add: value
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   193
    "Add a value to the specified pattern element. Value is added after existing values"
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   194
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   195
    ^ self at: attribute add: value append: true
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   196
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   197
    "Created: / 17-02-2016 / 14:23:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   198
!
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   199
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   200
at: attribute add: value append: append
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   201
    "Add a value to the specified pattern element.  If 'append' is true, the value
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   202
     is added after existing values, otherwise it is added before them."
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   203
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   204
    | error |
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   205
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   206
%{ /* STACK: 64000 */
7154
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   207
#ifdef HAVE_FONTCONFIG
7150
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   208
    FcValue v;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   209
    FcBool b;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   210
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   211
    if ( ! __externalAddressVal ( self ) ) {
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   212
	error = @symbol(Released);
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   213
	goto err;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   214
    }
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   215
    if ( ! __isStringLike ( attribute ) ) {
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   216
	error = @symbol(BadArg1);
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   217
	goto err;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   218
    }
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   219
    if ( append != true && append != false ) {
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   220
	error = @symbol(BadArg3);
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   221
	goto err;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   222
    }
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   223
    if ( __isStringLike ( value ) ) {
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   224
	v.type = FcTypeString;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   225
	/* Passing pointer inside Smalltalk should be safe,
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   226
	 * FontConfig library seem to allocate and store
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   227
	 * a __copy__ of the string (if I understood the code correctly)
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   228
	 */
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   229
	v.u.s = __stringVal( value);
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   230
    } else if ( __isSmallInteger( value ) ) {
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   231
	v.type = FcTypeInteger;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   232
	v.u.i = (int)__intVal( value );
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   233
    } else if ( value == true || value == false ) {
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   234
	v.type = FcTypeBool;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   235
	v.u.b = value == true ? FcTrue : FcFalse;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   236
    } else if ( __isFloat ( value ) ) {
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   237
	v.type = FcTypeDouble;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   238
	v.u.d = __floatVal( value );
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   239
    } else if ( value == nil ) {
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   240
	v.type = FcTypeVoid;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   241
	v.u.f = NULL;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   242
    } else {
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   243
	error = @symbol(BadArg2);
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   244
	goto err;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   245
    }
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   246
    b = FcPatternAdd( FC_PATTERN_VAL(self), __stringVal(attribute), v, append == true ? FcTrue : FcFalse );
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   247
    RETURN ( b == FcTrue ? true : false );
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   248
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   249
    err:;
7154
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   250
#endif
7150
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   251
%}.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   252
    self primitiveFailed: error
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   253
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   254
    "Created: / 20-12-2013 / 21:50:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   255
!
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   256
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   257
at: attribute ifAbsent: block
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   258
    "Return  a value of the specified pattern element. If there are multiple values,
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   259
     return them as an OrderedCollection. If attribute does not exist, evaluate `block`"
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   260
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   261
    | value values |
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   262
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   263
    value := self at: attribute index: 1.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   264
    value isNil ifTrue:[ ^ block value ].
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   265
    values := value.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   266
    value := self at: attribute index: 2.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   267
    value notNil ifTrue:[ 
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   268
        | i |    
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   269
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   270
        values := Array with: values with: value.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   271
        i := 3.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   272
        [ (value := self at: attribute index: i) notNil ] whileTrue:[ 
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   273
            values := values copyWith: value.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   274
            i := i + 1.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   275
        ].
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   276
    ].
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   277
    ^ values
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   278
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   279
    "Created: / 17-02-2016 / 14:32:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   280
!
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   281
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   282
at: attribute index: index
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   283
    "Return a value from the specified element -- multiple values can be indexed
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   284
     with 'index' starting at one."
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   285
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   286
    | error |
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   287
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   288
%{ /* STACK: 64000 */
7154
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   289
#ifdef HAVE_FONTCONFIG
7150
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   290
    FcValue v;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   291
    FcResult r;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   292
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   293
    if ( ! __externalAddressVal ( self ) ) {
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   294
	error = @symbol(Released);
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   295
	goto err;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   296
    }
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   297
    if ( ! __isStringLike ( attribute ) ) {
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   298
	error = @symbol(BadArg2);
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   299
	goto err;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   300
    }
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   301
    if ( ! __isSmallInteger( index ) ) {
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   302
	error = @symbol(BadArg3);
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   303
	goto err;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   304
    }
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   305
    r = FcPatternGet(FC_PATTERN_VAL(self), __stringVal( attribute ), __intVal( index ) - 1, &v);
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   306
    if ( r != FcResultMatch) {
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   307
	RETURN ( nil );
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   308
    }
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   309
    if ( v.type == FcTypeString) {
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   310
	RETURN ( __MKSTRING(v.u.s) );
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   311
    } else if ( v.type == FcTypeInteger ) {
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   312
	RETURN ( __MKINT (v.u.i) );
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   313
    } else if ( v.type == FcTypeBool ) {
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   314
	RETURN ( v.u.b == FcTrue ? true : false );
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   315
    } else if ( v.type == FcTypeDouble ) {
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   316
	RETURN ( __MKFLOAT (v.u.d) );
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   317
    } else if ( v.type == FcTypeVoid ) {
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   318
	RETURN ( nil );
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   319
    } else {
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   320
	error = @symbol(UnssuportedTypeValue);
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   321
	goto err;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   322
    }
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   323
    err:;
7154
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   324
#endif
7150
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   325
%}.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   326
    self primitiveFailed: error
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   327
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   328
!
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   329
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   330
at: attribute put: value
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   331
    "Add a value to the specified pattern element. All existing values are removed. 
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   332
     If `value` is a collection, all elements of that collection are added"
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   333
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   334
    self removeKey: attribute.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   335
    (value isCollection and:[ value isString not ]) ifTrue:[ 
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   336
        value do:[:each | 
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   337
            self at: attribute add: value append: true.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   338
        ].
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   339
    ] ifFalse:[ 
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   340
        self at: attribute add: value append: true.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   341
    ].
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   342
    ^ value
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   343
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   344
    "Created: / 17-02-2016 / 14:26:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   345
!
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   346
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   347
removeKey: attribute
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   348
    | error |
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   349
%{ /* STACK: 64000 */
7154
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   350
#ifdef HAVE_FONTCONFIG
7150
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   351
    if ( ! __externalAddressVal ( self ) ) {
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   352
	error = @symbol(Released);
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   353
	goto err;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   354
    }
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   355
    if ( ! __isStringLike ( attribute ) ) {
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   356
	error = @symbol(BadArg1);
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   357
	goto err;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   358
    }
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   359
    FcPatternDel( FC_PATTERN_VAL(self), __stringVal ( attribute ) );
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   360
    RETURN ( self );
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   361
    err:;
7154
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   362
#endif
7150
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   363
%}.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   364
    self primitiveFailed: error
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   365
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   366
! !
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   367
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   368
!FcPattern methodsFor:'comparing'!
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   369
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   370
= another
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   371
    self class == another class ifFalse:[ ^ false ].
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   372
%{ /* STACK: 64000 */
7154
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   373
#ifdef HAVE_FONTCONFIG
7150
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   374
    FcPattern* pa = FC_PATTERN_VAL(self);
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   375
    FcPattern* pb = FC_PATTERN_VAL(another);
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   376
    if (pa != NULL && pb != NULL) {
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   377
    	RETURN ( FcPatternEqual(pa, pb) == FcTrue ? true : false );
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   378
    }
7154
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   379
#endif
7150
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   380
%}.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   381
    ^ false
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   382
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   383
    "Created: / 17-02-2016 / 11:01:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   384
!
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   385
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   386
hash
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   387
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   388
%{ /* STACK: 64000 */
7154
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   389
#ifdef HAVE_FONTCONFIG
7150
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   390
    unsigned int h = 0;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   391
    if (__externalAddressVal(self) != NULL) {
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   392
        h = FcPatternHash(FC_PATTERN_VAL(self));
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   393
        h &= 0x7FFFFFFFU;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   394
    }
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   395
    RETURN ( __MKSMALLINT( h ) );	
7154
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   396
#endif
7150
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   397
%}.    
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   398
    ^self primitiveFailed
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   399
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   400
    "Created: / 17-02-2016 / 10:59:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   401
! !
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   402
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   403
!FcPattern methodsFor:'conversion'!
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   404
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   405
asString
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   406
%{ /* STACK: 64000 */
7154
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   407
#ifdef HAVE_FONTCONFIG
7150
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   408
    char *_s;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   409
    OBJ s;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   410
    if (__externalAddressVal(self) != NULL) {
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   411
    	_s = (char*)FcNameUnparse(FC_PATTERN_VAL(self));
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   412
    	s = __MKSTRING(_s);
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   413
    	free(_s);
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   414
    	RETURN ( s );
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   415
    }   
7154
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   416
#endif
7150
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   417
%}.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   418
    self primitiveFailed
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   419
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   420
    "Created: / 17-02-2016 / 10:55:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   421
! !
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   422
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   423
!FcPattern methodsFor:'copying'!
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   424
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   425
postCopy
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   426
%{ /* STACK: 64000 */
7154
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   427
#ifdef HAVE_FONTCONFIG
7150
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   428
    __externalAddressVal(self) = (void*)FcPatternDuplicate(FC_PATTERN_VAL(self));	
7154
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   429
#endif
7150
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   430
%}.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   431
    self registerForFinalization
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   432
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   433
    "Created: / 17-02-2016 / 10:58:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   434
! !
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   435
7154
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   436
!FcPattern methodsFor:'error handling'!
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   437
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   438
primitiveFailed
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   439
    <resource: #skipInDebuggersWalkBack>
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   440
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   441
    (ConfigurableFeatures hasFontConfig) ifFalse:[ 
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   442
        super primitiveFailed: 'FontConfig support not compiled in. Recompile with -DHAVE_FONTCONFIG'.        
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   443
    ].
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   444
    ^ super primitiveFailed
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   445
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   446
    "Created: / 22-02-2016 / 08:12:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   447
!
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   448
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   449
primitiveFailed: message
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   450
    <resource: #skipInDebuggersWalkBack>
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   451
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   452
    (ConfigurableFeatures hasFontConfig) ifFalse:[ 
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   453
        super primitiveFailed: 'FontConfig support not compiled in. Recompile with -DHAVE_FONTCONFIG'.        
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   454
    ].
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   455
    ^ super primitiveFailed: message
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   456
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   457
    "Created: / 22-02-2016 / 08:13:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   458
! !
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   459
7150
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   460
!FcPattern methodsFor:'finalization'!
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   461
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   462
destroy
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   463
    %{ /* STACK: 64000 */
7154
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   464
#ifdef HAVE_FONTCONFIG
7150
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   465
    FcPatternDestroy((FcPattern*)__externalAddressVal(self));
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   466
    __externalAddressVal(self) = NULL;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   467
    RETURN ( self );
7154
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   468
    #endif
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   469
%}.
7150
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   470
    self primitiveFailed.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   471
!
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   472
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   473
finalize
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   474
    self destroy
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   475
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   476
    "Created: / 16-02-2016 / 19:05:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   477
! !
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   478
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   479
!FcPattern methodsFor:'initialization & release'!
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   480
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   481
initialize    
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   482
%{ /* STACK: 64000 */
7154
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   483
#ifdef HAVE_FONTCONFIG
7150
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   484
    __externalAddressVal(self) = (void*)FcPatternCreate();
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   485
    __SSEND0(self, @symbol(registerForFinalization), 4);
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   486
    RETURN ( self );
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   487
    err:;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   488
7154
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   489
#endif
7150
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   490
%}.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   491
    self primitiveFailed.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   492
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   493
    "Created: / 16-02-2016 / 19:04:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   494
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   495
!
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   496
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   497
initializeFromString: aString
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   498
    | error |
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   499
%{ /* STACK: 64000 */
7154
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   500
#ifdef HAVE_FONTCONFIG
7150
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   501
    if ( ! __isStringLike ( aString ) ) {
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   502
	error = @symbol(BadArg1);
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   503
	goto err;
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   504
    }
7151
51e71e95c952 X11/FontConfig: Removed all FontConfig related code from XftFontDescription
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7150
diff changeset
   505
    __externalAddressVal(self) = (void*)FcNameParse(__stringVal(aString));
7150
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   506
    __SSEND0(self, @symbol(registerForFinalization), 4);
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   507
    RETURN ( self );
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   508
    err:;
7154
f2d585b5f20e X11/FontConfig: Conditionally compile FontConfig support
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7151
diff changeset
   509
#endif
7150
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   510
%}.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   511
    self primitiveFailed.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   512
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   513
!
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   514
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   515
release
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   516
    self unregisterForFinalization.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   517
    self destroy
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   518
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   519
    "Created: / 16-02-2016 / 19:04:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   520
! !
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   521
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   522
!FcPattern methodsFor:'printing & storing'!
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   523
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   524
printOn:aStream
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   525
    | string |
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   526
    super printOn: aStream.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   527
    string := self asString.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   528
    string notEmptyOrNil ifTrue:[
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   529
        aStream nextPutAll: ' - '.
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   530
        aStream nextPutAll: self asString  
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   531
    ]
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   532
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   533
    "Modified: / 17-02-2016 / 17:29:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   534
! !
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   535
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   536
!FcPattern class methodsFor:'documentation'!
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   537
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   538
version_HG
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   539
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   540
    ^ '$Changeset: <not expanded> $'
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   541
! !
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   542
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   543
000f5ae96151 X11/FontConfig: FontConfig related code extracted from XftFontDescription to separate classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   544
FcPattern initialize!