home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-bin / x11r6.1 / man / cat3 / xqueryfont.0 < prev    next >
Encoding:
Text File  |  1996-10-17  |  14.1 KB  |  397 lines

  1.  
  2.  
  3.  
  4. XLoadFont(3X11)          XLIB FUNCTIONS      XLoadFont(3X11)
  5.  
  6.  
  7. NNAAMMEE
  8.        XLoadFont, XQueryFont, XLoadQueryFont, XFreeFont, XGet-
  9.        FontProperty, XUnloadFont, XCharStruct, XFontProp,
  10.        XChar2b, XFontStruct - load or unload fonts and font met-
  11.        ric structures
  12.  
  13. SSYYNNTTAAXX
  14.        Font XLoadFont(_d_i_s_p_l_a_y, _n_a_m_e)
  15.          Display *_d_i_s_p_l_a_y;
  16.          char *_n_a_m_e;
  17.  
  18.        XFontStruct *XQueryFont(_d_i_s_p_l_a_y, _f_o_n_t___I_D)
  19.          Display *_d_i_s_p_l_a_y;
  20.          XID _f_o_n_t___I_D;
  21.  
  22.        XFontStruct *XLoadQueryFont(_d_i_s_p_l_a_y, _n_a_m_e)
  23.          Display *_d_i_s_p_l_a_y;
  24.          char *_n_a_m_e;
  25.  
  26.        XFreeFont(_d_i_s_p_l_a_y, _f_o_n_t___s_t_r_u_c_t)
  27.          Display *_d_i_s_p_l_a_y;
  28.          XFontStruct *_f_o_n_t___s_t_r_u_c_t;
  29.  
  30.        Bool XGetFontProperty(_f_o_n_t___s_t_r_u_c_t, _a_t_o_m, _v_a_l_u_e___r_e_t_u_r_n)
  31.          XFontStruct *_f_o_n_t___s_t_r_u_c_t;
  32.          Atom _a_t_o_m;
  33.          unsigned long *_v_a_l_u_e___r_e_t_u_r_n;
  34.  
  35.        XUnloadFont(_d_i_s_p_l_a_y, _f_o_n_t)
  36.          Display *_d_i_s_p_l_a_y;
  37.          Font _f_o_n_t;
  38.  
  39. AARRGGUUMMEENNTTSS
  40.        _a_t_o_m     Specifies the atom for the property name you
  41.          want returned.
  42.  
  43.        _d_i_s_p_l_a_y     Specifies the connection to the X server.
  44.  
  45.        _f_o_n_t     Specifies the font.
  46.  
  47.        _f_o_n_t___I_D     Specifies the font ID or the _G_C_o_n_t_e_x_t ID.
  48.  
  49.        _f_o_n_t___s_t_r_u_c_t
  50.          Specifies the storage associated with the font.
  51.  
  52.        _g_c     Specifies the GC.
  53.  
  54.        _n_a_m_e     Specifies the name of the font, which is a null-
  55.          terminated string.
  56.  
  57.        _v_a_l_u_e___r_e_t_u_r_n
  58.          Returns the value of the font property.
  59.  
  60.  
  61.  
  62.  
  63.  
  64. X Version 11           Release 6.1                1
  65.  
  66.  
  67.  
  68.  
  69.  
  70. XLoadFont(3X11)          XLIB FUNCTIONS      XLoadFont(3X11)
  71.  
  72.  
  73. DDEESSCCRRIIPPTTIIOONN
  74.        The _X_L_o_a_d_F_o_n_t function loads the specified font and
  75.        returns its associated font ID.    If the font name is not
  76.        in the Host Portable Character Encoding, the result is
  77.        implementation-dependent.  Use of uppercase or lowercase
  78.        does not matter.     When the characters ``?'' and ``*'' are
  79.        used in a font name, a pattern match is performed and any
  80.        matching font is used.  In the pattern, the ``?'' charac-
  81.        ter will match any single character, and the ``*'' charac-
  82.        ter will match any number of characters.     A structured
  83.        format for font names is specified in the X Consortium
  84.        standard _X _L_o_g_i_c_a_l _F_o_n_t _D_e_s_c_r_i_p_t_i_o_n _C_o_n_v_e_n_t_i_o_n_s.     If
  85.        _X_L_o_a_d_F_o_n_t was unsuccessful at loading the specified font,
  86.        a _B_a_d_N_a_m_e error results.     Fonts are not associated with a
  87.        particular screen and can be stored as a component of any
  88.        GC.  When the font is no longer needed, call _X_U_n_l_o_a_d_F_o_n_t.
  89.  
  90.        _X_L_o_a_d_F_o_n_t can generate _B_a_d_A_l_l_o_c and _B_a_d_N_a_m_e errors.
  91.  
  92.        The _X_Q_u_e_r_y_F_o_n_t function returns a pointer to the
  93.        _X_F_o_n_t_S_t_r_u_c_t structure, which contains information associ-
  94.        ated with the font.  You can query a font or the font
  95.        stored in a GC.    The font ID stored in the _X_F_o_n_t_S_t_r_u_c_t
  96.        structure will be the _G_C_o_n_t_e_x_t ID, and you need to be
  97.        careful when using this ID in other functions (see
  98.        _X_G_C_o_n_t_e_x_t_F_r_o_m_G_C).  If the font does not exist, _X_Q_u_e_r_y_F_o_n_t
  99.        returns NULL.  To free this data, use _X_F_r_e_e_F_o_n_t_I_n_f_o.
  100.  
  101.        _X_L_o_a_d_Q_u_e_r_y_F_o_n_t can generate a _B_a_d_A_l_l_o_c error.
  102.  
  103.        The _X_L_o_a_d_Q_u_e_r_y_F_o_n_t function provides the most common way
  104.        for accessing a font.  _X_L_o_a_d_Q_u_e_r_y_F_o_n_t both opens (loads)
  105.        the specified font and returns a pointer to the appropri-
  106.        ate _X_F_o_n_t_S_t_r_u_c_t structure.  If the font name is not in the
  107.        Host Portable Character Encoding, the result is implemen-
  108.        tation-dependent.  If the font does not exist, _X_L_o_a_d_Q_u_e_r_y_-
  109.        _F_o_n_t returns NULL.
  110.  
  111.        The _X_F_r_e_e_F_o_n_t function deletes the association between the
  112.        font resource ID and the specified font and frees the
  113.        _X_F_o_n_t_S_t_r_u_c_t structure.  The font itself will be freed when
  114.        no other resource references it.     The data and the font
  115.        should not be referenced again.
  116.  
  117.        _X_F_r_e_e_F_o_n_t can generate a _B_a_d_F_o_n_t error.
  118.  
  119.        Given the atom for that property, the _X_G_e_t_F_o_n_t_P_r_o_p_e_r_t_y
  120.        function returns the value of the specified font property.
  121.        _X_G_e_t_F_o_n_t_P_r_o_p_e_r_t_y also returns _F_a_l_s_e if the property was
  122.        not defined or _T_r_u_e if it was defined.  A set of prede-
  123.        fined atoms exists for font properties, which can be found
  124.        in <_X_1_1_/_X_a_t_o_m_._h>.  This set contains the standard proper-
  125.        ties associated with a font.  Although it is not guaran-
  126.        teed, it is likely that the predefined font properties
  127.  
  128.  
  129.  
  130. X Version 11           Release 6.1                2
  131.  
  132.  
  133.  
  134.  
  135.  
  136. XLoadFont(3X11)          XLIB FUNCTIONS      XLoadFont(3X11)
  137.  
  138.  
  139.        will be present.
  140.  
  141.        The _X_U_n_l_o_a_d_F_o_n_t function deletes the association between
  142.        the font resource ID and the specified font.  The font
  143.        itself will be freed when no other resource references it.
  144.        The font should not be referenced again.
  145.  
  146.        _X_U_n_l_o_a_d_F_o_n_t can generate a _B_a_d_F_o_n_t error.
  147.  
  148. SSTTRRUUCCTTUURREESS
  149.        The _X_F_o_n_t_S_t_r_u_c_t structure contains all of the information
  150.        for the font and consists of the font-specific information
  151.        as well as a pointer to an array of _X_C_h_a_r_S_t_r_u_c_t structures
  152.        for the characters contained in the font.  The
  153.        _X_F_o_n_t_S_t_r_u_c_t, _X_F_o_n_t_P_r_o_p, and _X_C_h_a_r_S_t_r_u_c_t structures con-
  154.        tain:
  155.  
  156.        typedef struct {
  157.         short lbearing;         /* origin to left edge of raster */
  158.         short rbearing;         /* origin to right edge of raster */
  159.         short width;         /* advance to next char's origin */
  160.         short ascent;         /* baseline to top edge of raster */
  161.         short descent;         /* baseline to bottom edge of raster */
  162.         unsigned short attributes;/* per char flags (not predefined) */
  163.        } XCharStruct;
  164.  
  165.        typedef struct {
  166.         Atom name;
  167.         unsigned long card32;
  168.        } XFontProp;
  169.  
  170.        typedef struct {             /* normal 16 bit characters are two bytes */
  171.        unsigned char byte1;
  172.        unsigned char byte2;
  173.        } XChar2b;
  174.  
  175.        typedef struct {
  176.         XExtData *ext_data;         /* hook for extension to hang data */
  177.         Font fid;             /* Font id for this font */
  178.         unsigned direction;         /* hint about the direction font is painted */
  179.         unsigned min_char_or_byte2;/* first character */
  180.         unsigned max_char_or_byte2;/* last character */
  181.         unsigned min_byte1;         /* first row that exists */
  182.         unsigned max_byte1;         /* last row that exists */
  183.         Bool all_chars_exist;    /* flag if all characters have nonzero size */
  184.         unsigned default_char;   /* char to print for undefined character */
  185.         int n_properties;         /* how many properties there are */
  186.         XFontProp *properties;   /* pointer to array of additional properties */
  187.         XCharStruct min_bounds;  /* minimum bounds over all existing char */
  188.         XCharStruct max_bounds;  /* maximum bounds over all existing char */
  189.         XCharStruct *per_char;   /* first_char to last_char information */
  190.         int ascent;             /* logical extent above baseline for spacing */
  191.         int descent;         /* logical decent below baseline for spacing */
  192.        } XFontStruct;
  193.  
  194.  
  195.  
  196. X Version 11           Release 6.1                3
  197.  
  198.  
  199.  
  200.  
  201.  
  202. XLoadFont(3X11)          XLIB FUNCTIONS      XLoadFont(3X11)
  203.  
  204.  
  205.        X supports single byte/character, two bytes/character
  206.        matrix, and 16-bit character text operations.  Note that
  207.        any of these forms can be used with a font, but a single
  208.        byte/character text request can only specify a single byte
  209.        (that is, the first row of a 2-byte font).  You should
  210.        view 2-byte fonts as a two-dimensional matrix of defined
  211.        characters: byte1 specifies the range of defined rows and
  212.        byte2 defines the range of defined columns of the font.
  213.        Single byte/character fonts have one row defined, and the
  214.        byte2 range specified in the structure defines a range of
  215.        characters.
  216.  
  217.        The bounding box of a character is defined by the
  218.        _X_C_h_a_r_S_t_r_u_c_t of that character.  When characters are absent
  219.        from a font, the default_char is used.  When fonts have
  220.        all characters of the same size, only the information in
  221.        the _X_F_o_n_t_S_t_r_u_c_t min and max bounds are used.
  222.  
  223.        The members of the _X_F_o_n_t_S_t_r_u_c_t have the following seman-
  224.        tics:
  225.  
  226.        +o    The direction member can be either _F_o_n_t_L_e_f_t_T_o_R_i_g_h_t or
  227.         _F_o_n_t_R_i_g_h_t_T_o_L_e_f_t.  It is just a hint as to whether
  228.         most _X_C_h_a_r_S_t_r_u_c_t elements have a positive
  229.         (_F_o_n_t_L_e_f_t_T_o_R_i_g_h_t) or a negative (_F_o_n_t_R_i_g_h_t_T_o_L_e_f_t)
  230.         character width metric.  The core protocol defines no
  231.         support for vertical text.
  232.  
  233.        +o    If the min_byte1 and max_byte1 members are both zero,
  234.         min_char_or_byte2 specifies the linear character
  235.         index corresponding to the first element of the
  236.         per_char array, and max_char_or_byte2 specifies the
  237.         linear character index of the last element.
  238.  
  239.         If either min_byte1 or max_byte1 are nonzero, both
  240.         min_char_or_byte2 and max_char_or_byte2 are less than
  241.         256, and the 2-byte character index values corre-
  242.         sponding to the per_char array element N (counting
  243.         from 0) are:
  244.  
  245.          byte1 = N/D + min_byte1
  246.          byte2 = N\D + min_char_or_byte2
  247.  
  248.         where:
  249.  
  250.             D = max_char_or_byte2 - min_char_or_byte2 + 1
  251.             / = integer division
  252.             \ = integer modulus
  253.  
  254.        +o    If the per_char pointer is NULL, all glyphs between
  255.         the first and last character indexes inclusive have
  256.         the same information, as given by both min_bounds and
  257.         max_bounds.
  258.  
  259.  
  260.  
  261.  
  262. X Version 11           Release 6.1                4
  263.  
  264.  
  265.  
  266.  
  267.  
  268. XLoadFont(3X11)          XLIB FUNCTIONS      XLoadFont(3X11)
  269.  
  270.  
  271.        +o    If all_chars_exist is _T_r_u_e, all characters in the
  272.         per_char array have nonzero bounding boxes.
  273.  
  274.        +o    The default_char member specifies the character that
  275.         will be used when an undefined or nonexistent charac-
  276.         ter is printed.  The default_char is a 16-bit charac-
  277.         ter (not a 2-byte character).  For a font using
  278.         2-byte matrix format, the default_char has byte1 in
  279.         the most-significant byte and byte2 in the least sig-
  280.         nificant byte.  If the default_char itself specifies
  281.         an undefined or nonexistent character, no printing is
  282.         performed for an undefined or nonexistent character.
  283.  
  284.        +o    The min_bounds and max_bounds members contain the
  285.         most extreme values of each individual _X_C_h_a_r_S_t_r_u_c_t
  286.         component over all elements of this array (and ignore
  287.         nonexistent characters).  The bounding box of the
  288.         font (the smallest rectangle enclosing the shape
  289.         obtained by superimposing all of the characters at
  290.         the same origin [x,y]) has its upper-left coordinate
  291.         at:
  292.          [x + min_bounds.lbearing, y - max_bounds.ascent]
  293.  
  294.         Its width is:
  295.          max_bounds.rbearing - min_bounds.lbearing
  296.  
  297.         Its height is:
  298.          max_bounds.ascent + max_bounds.descent
  299.  
  300.        +o    The ascent member is the logical extent of the font
  301.         above the baseline that is used for determining line
  302.         spacing.  Specific characters may extend beyond this.
  303.  
  304.        +o    The descent member is the logical extent of the font
  305.         at or below the baseline that is used for determining
  306.         line spacing.  Specific characters may extend beyond
  307.         this.
  308.  
  309.        +o    If the baseline is at Y-coordinate y, the logical
  310.         extent of the font is inclusive between the Y-
  311.         coordinate values (y - font.ascent) and (y +
  312.         font.descent - 1).    Typically, the minimum interline
  313.         spacing between rows of text is given by ascent +
  314.         descent.
  315.  
  316.        For a character origin at [x,y], the bounding box of a
  317.        character (that is, the smallest rectangle that encloses
  318.        the character's shape) described in terms of _X_C_h_a_r_S_t_r_u_c_t
  319.        components is a rectangle with its upper-left corner at:
  320.  
  321.        [x + lbearing, y - ascent]
  322.  
  323.        Its width is:
  324.  
  325.  
  326.  
  327.  
  328. X Version 11           Release 6.1                5
  329.  
  330.  
  331.  
  332.  
  333.  
  334. XLoadFont(3X11)          XLIB FUNCTIONS      XLoadFont(3X11)
  335.  
  336.  
  337.        rbearing - lbearing
  338.  
  339.        Its height is:
  340.  
  341.        ascent + descent
  342.  
  343.        The origin for the next character is defined to be:
  344.  
  345.        [x + width, y]
  346.  
  347.        The lbearing member defines the extent of the left edge of
  348.        the character ink from the origin.  The rbearing member
  349.        defines the extent of the right edge of the character ink
  350.        from the origin.     The ascent member defines the extent of
  351.        the top edge of the character ink from the origin.  The
  352.        descent member defines the extent of the bottom edge of
  353.        the character ink from the origin.  The width member
  354.        defines the logical width of the character.
  355.  
  356. DDIIAAGGNNOOSSTTIICCSS
  357.        _B_a_d_A_l_l_o_c     The server failed to allocate the requested
  358.          resource or server memory.
  359.  
  360.        _B_a_d_F_o_n_t     A value for a Font or GContext argument does not
  361.          name a defined Font.
  362.  
  363.        _B_a_d_N_a_m_e     A font or color of the specified name does not
  364.          exist.
  365.  
  366. SSEEEE AALLSSOO
  367.        XCreateGC(3X11), XListFonts(3X11), XSetFontPath(3X11)
  368.        _X_l_i_b _- _C _L_a_n_g_u_a_g_e _X _I_n_t_e_r_f_a_c_e
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394. X Version 11           Release 6.1                6
  395.  
  396.  
  397.