## Xml Writer

Xml Writer — Convenience class for generating Fontconfig xml files

## Functions

FontManagerXmlWriter * | font_manager_xml_writer_new ()
gboolean | font_manager_xml_writer_open ()
gboolean | font_manager_xml_writer_close ()
void | font_manager_xml_writer_discard ()
gint | font_manager_xml_writer_start_element ()
gint | font_manager_xml_writer_end_element ()
gint | font_manager_xml_writer_write_element ()
gint | font_manager_xml_writer_write_attribute ()
void | font_manager_xml_writer_add_assignment ()
void | font_manager_xml_writer_add_elements ()
void | font_manager_xml_writer_add_patelt ()
void | font_manager_xml_writer_add_selections ()
void | font_manager_xml_writer_add_test_element ()

## Properties

char * | filepath | Read

## Types and Values

#define | FONT_MANAGER_TYPE_XML_WRITER
| FontManagerXmlWriter

## Object Hierarchy

        GObject
        ╰── FontManagerXmlWriter

## Includes

    #include <font-manager-xml-writer.h>

## Description

Convenience class for generating fontconfig configuration files.

## Functions

### font_manager_xml_writer_new ()

    FontManagerXmlWriter *
    font_manager_xml_writer_new (void);

#### Returns

A newly created FontManagerXmlWriter. Free the returned object using ``g_object_unref()``.

[transfer full]

### font_manager_xml_writer_open ()

    gboolean
    font_manager_xml_writer_open (FontManagerXmlWriter *self,
                                  const gchar *filepath);

#### Parameters

self | FontManagerXmlWriter |
filepath | filepath to open for editing |

#### Returns

`TRUE` on success

### font_manager_xml_writer_close ()

    gboolean
    font_manager_xml_writer_close (FontManagerXmlWriter *self);

Save and close current document

#### Parameters

self | FontManagerXmlWriter |

#### Returns

`TRUE` if document was successfully saved

### font_manager_xml_writer_discard ()

    void
    font_manager_xml_writer_discard (FontManagerXmlWriter *self);

Close current document without saving.

#### Parameters

self | FontManagerXmlWriter |

### font_manager_xml_writer_start_element ()

    gint
    font_manager_xml_writer_start_element (FontManagerXmlWriter *self,
                                           const gchar *name);

Start an xml element.

#### Parameters

self | FontManagerXmlWriter |
name | element name |

#### Returns

The number of bytes written (may be 0 because of buffering) or -1 in case of error.

### font_manager_xml_writer_end_element ()

    gint
    font_manager_xml_writer_end_element (FontManagerXmlWriter *self);

End the current xml element.

#### Parameters

self | FontManagerXmlWriter |

#### Returns

The number of bytes written (may be 0 because of buffering) or -1 in case of error.

### font_manager_xml_writer_write_element ()

    gint
    font_manager_xml_writer_write_element (FontManagerXmlWriter *self,
                                           const gchar *name,
                                           const gchar *content);

#### Parameters

self | FontManagerXmlWriter |
name | element name |
content | element content |

#### Returns

The number of bytes written (may be 0 because of buffering) or -1 in case of error.

### font_manager_xml_writer_write_attribute ()

    gint
    font_manager_xml_writer_write_attribute
                                   (FontManagerXmlWriter *self,
                                    const gchar *name,
                                    const gchar *content);

#### Parameters

self | FontManagerXmlWriter |
name | attribute name |
content | attribute content |

#### Returns

The number of bytes written (may be 0 because of buffering) or -1 in case of error.

### font_manager_xml_writer_add_assignment ()

    void
    font_manager_xml_writer_add_assignment
                                   (FontManagerXmlWriter *self,
                                    const gchar *a_name,
                                    const gchar *a_type,
                                    const gchar *a_val);

Assign a new value to a Fontconfig property. Valid types are int, double, bool and string.

#### Parameters

self | FontManagerXmlWriter |
a_name | name of property to edit |
a_type | type of the property |
a_val | new value to assign |

### font_manager_xml_writer_add_elements ()

    void
    font_manager_xml_writer_add_elements (FontManagerXmlWriter *self,
                                          const gchar *e_type,
                                          GList *elements);

Add simple elements to a fontconfig configuration file.

#### Parameters

self | FontManagerXmlWriter |
e_type | element type |
elements | GList. | [element-type utf8][transfer none]

### font_manager_xml_writer_add_patelt ()

    void
    font_manager_xml_writer_add_patelt (FontManagerXmlWriter *self,
                                        const gchar *p_name,
                                        const gchar *p_type,
                                        const gchar *p_val);

Write a valid fontconfig pattern elt. Valid patelt types are int, double, string, bool and const.

#### Parameters

self | FontManagerXmlWriter |
p_name | patelt name |
p_type | patelt type |
p_val | patelt value |

### font_manager_xml_writer_add_selections ()

    void
    font_manager_xml_writer_add_selections
                                   (FontManagerXmlWriter *self,
                                    const gchar *selection_type,
                                    GList *selections);

Whitelist or blacklist a GList of font families.

#### Parameters

self | FontManagerXmlWriter |
selection_type | acceptfont or rejectfont |
selections | GList containing font family names. | [element-type utf8][transfer none]

### font_manager_xml_writer_add_test_element ()

    void
    font_manager_xml_writer_add_test_element
                                   (FontManagerXmlWriter *self,
                                    const gchar *t_name,
                                    const gchar *t_test,
                                    const gchar *t_type,
                                    const gchar *t_val);

Valid comparison operators can be one of eq, not_eq, less, less_eq, more, more_eq, contains or not_contains. Valid value types are int, double, string, bool and const.

#### Parameters

self | FontManagerXmlWriter |
t_name | fontconfig property to test |
t_test | valid comparison operator |
t_type | value type |
t_val | value |

## Types and Values

### FONT_MANAGER_TYPE_XML_WRITER

    #define FONT_MANAGER_TYPE_XML_WRITER (font_manager_xml_writer_get_type())

### FontManagerXmlWriter

    typedef struct _FontManagerXmlWriter FontManagerXmlWriter;

## Property Details

### The `“filepath”` property

      “filepath”                 char *

Path to file.

Owner: FontManagerXmlWriter

Flags: Read

Default value: NULL

## See Also

https://www.freedesktop.org/software/fontconfig/fontconfig-user.html