<div dir="ltr">Hi,<div>Do I only need to call FcConfigDestroy to destroy the config, pattern, objectset and the fontset or I need to call them all like I am currently doing?<br></div><div><div></div></div><div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Consolas,"Courier New",monospace;font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(156,220,254)">fonts_filename</span> = <span style="color:rgb(78,201,176)">set</span>()</div><br><div><span style="color:rgb(156,220,254)">config</span> = <span style="color:rgb(78,201,176)">LinuxFonts</span>.<span style="color:rgb(156,220,254)">_font_config</span>.FcInitLoadConfigAndFonts()</div><div><span style="color:rgb(156,220,254)">pat</span> = <span style="color:rgb(78,201,176)">LinuxFonts</span>.<span style="color:rgb(156,220,254)">_font_config</span>.FcPatternCreate()</div><div><span style="color:rgb(156,220,254)">os</span> = <span style="color:rgb(78,201,176)">LinuxFonts</span>.<span style="color:rgb(156,220,254)">_font_config</span>.FcObjectSetBuild(<span style="color:rgb(86,156,214)">b</span><span style="color:rgb(206,145,120)">"file"</span>, <span style="color:rgb(86,156,214)">b</span><span style="color:rgb(206,145,120)">"fontformat"</span>, <span style="color:rgb(181,206,168)">0</span>)</div><div><span style="color:rgb(156,220,254)">fs</span> = <span style="color:rgb(78,201,176)">LinuxFonts</span>.<span style="color:rgb(156,220,254)">_font_config</span>.FcFontList(<span style="color:rgb(156,220,254)">config</span>, <span style="color:rgb(156,220,254)">pat</span>, <span style="color:rgb(86,156,214)">None</span>)</div><br><div><span style="color:rgb(197,134,192)">for</span> <span style="color:rgb(156,220,254)">i</span> <span style="color:rgb(197,134,192)">in</span> <span style="color:rgb(78,201,176)">range</span>(<span style="color:rgb(156,220,254)">fs</span>.contents.nfont):</div><div>    <span style="color:rgb(156,220,254)">font</span> = <span style="color:rgb(156,220,254)">fs</span>.contents.fonts[<span style="color:rgb(156,220,254)">i</span>]</div><div>    <span style="color:rgb(156,220,254)">file_path_ptr</span> = <span style="color:rgb(78,201,176)">c_char_p</span>()</div><div>    <span style="color:rgb(156,220,254)">font_format_ptr</span> = <span style="color:rgb(78,201,176)">c_char_p</span>()</div><br><div>    <span style="color:rgb(197,134,192)">if</span> (</div><div>        <span style="color:rgb(78,201,176)">LinuxFonts</span>.<span style="color:rgb(156,220,254)">_font_config</span>.FcPatternGetString(<span style="color:rgb(156,220,254)">font</span>, <span style="color:rgb(86,156,214)">b</span><span style="color:rgb(206,145,120)">"fontformat"</span>, <span style="color:rgb(181,206,168)">0</span>, <span style="color:rgb(220,220,170)">byref</span>(<span style="color:rgb(156,220,254)">font_format_ptr</span>)) == <span style="color:rgb(78,201,176)">FC_RESULT</span>.<span style="color:rgb(79,193,255)">FC_RESULT_MATCH</span></div><div>        <span style="color:rgb(86,156,214)">and</span> <span style="color:rgb(78,201,176)">LinuxFonts</span>.<span style="color:rgb(156,220,254)">_font_config</span>.FcPatternGetString(<span style="color:rgb(156,220,254)">font</span>, <span style="color:rgb(86,156,214)">b</span><span style="color:rgb(206,145,120)">"file"</span>, <span style="color:rgb(181,206,168)">0</span>, <span style="color:rgb(220,220,170)">byref</span>(<span style="color:rgb(156,220,254)">file_path_ptr</span>)) == <span style="color:rgb(78,201,176)">FC_RESULT</span>.<span style="color:rgb(79,193,255)">FC_RESULT_MATCH</span></div><div>    ):</div><div>        <span style="color:rgb(156,220,254)">font_format</span> = <span style="color:rgb(78,201,176)">FT_FONT_FORMAT</span>(<span style="color:rgb(156,220,254)">font_format_ptr</span>.<span style="color:rgb(156,220,254)">value</span>)</div><br><div>        <span style="color:rgb(197,134,192)">if</span> <span style="color:rgb(156,220,254)">font_format</span> <span style="color:rgb(86,156,214)">in</span> <span style="color:rgb(78,201,176)">LinuxFonts</span>.<span style="color:rgb(156,220,254)">VALID_FONT_FORMATS</span>:</div><div>            <span style="color:rgb(106,153,85)"># Decode with utf-8 since FcChar8</span></div><div>            <span style="color:rgb(156,220,254)">fonts_filename</span>.<span style="color:rgb(220,220,170)">add</span>(<span style="color:rgb(156,220,254)">file_path_ptr</span>.<span style="color:rgb(156,220,254)">value</span>.<span style="color:rgb(220,220,170)">decode</span>())</div><br><div><span style="color:rgb(106,153,85)"># I am not 100% if we need to call all of these. We may only need to call FcFontSetDestroy.</span></div><div><span style="color:rgb(78,201,176)">LinuxFonts</span>.<span style="color:rgb(156,220,254)">_font_config</span>.FcConfigDestroy(<span style="color:rgb(156,220,254)">config</span>)</div><div><span style="color:rgb(78,201,176)">LinuxFonts</span>.<span style="color:rgb(156,220,254)">_font_config</span>.FcPatternDestroy(<span style="color:rgb(156,220,254)">pat</span>)</div><div><span style="color:rgb(78,201,176)">LinuxFonts</span>.<span style="color:rgb(156,220,254)">_font_config</span>.FcObjectSetDestroy(<span style="color:rgb(156,220,254)">os</span>)</div><div><span style="color:rgb(78,201,176)">LinuxFonts</span>.<span style="color:rgb(156,220,254)">_font_config</span>.FcFontSetDestroy(<span style="color:rgb(156,220,254)">fs</span>)</div><br><div></div></div></div><div><br></div><div>The full code is available <a href="https://paste.pythondiscord.com/ijokojofif">here</a></div></div>