<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hello Dheeraj,</p>
    I think fontconfig.h does not provide any function calculating
    string or character width.<br>
    But Xft.h does.<br>
    You extract pertinent data from your FcPattern like family, size,
    slant, weight and for you spacing which must be 0.<br>
    Then you open your font like this (example) :
    <p>XftFont * font=XftFontOpenName(display,screen,newFont);</p>
    <p>where newFont could be "Liberation
      Sans-12:bold:roman:proportional"</p>
    <p>You can now calculate the width of the character 'm' via this
      command :<br>
    </p>
    XGlyphInfo glyphInfo;<br>
    XftTextExtentsUtf8 (display,font,"m",1,&glyphInfo);
    <p>glyphInfo.width contains the width of your character<br>
    </p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">Le 05/02/2020 à 10:48, Dheeraj Yadav a
      écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:CACs68ozD+Bw+CxSZ8_XX2OcxhG6=bsFcOwHFpQ_2TxDtueaWSQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="auto">DheerajHi Akira,
        <div dir="auto">Thanks for the reply.</div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">I know it doesn't affect rendering but I am
          working on converting text to pdf. So, I need to get the value
          of width of each character.</div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">Cheers</div>
        <div dir="auto">Dheeraj</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Wed, Feb 5, 2020, 2:58 PM
          Akira TAGOH <<a href="mailto:akira@tagoh.org"
            rel="noreferrer noreferrer" target="_blank"
            moz-do-not-send="true">akira@tagoh.org</a>> wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">On Wed, Feb
          5, 2020 at 6:06 PM Dheeraj Yadav <<a
            href="mailto:dhirajyadav135@gmail.com" rel="noreferrer
            noreferrer noreferrer" target="_blank"
            moz-do-not-send="true">dhirajyadav135@gmail.com</a>>
          wrote:<br>
          ><br>
          > Hello everyone,<br>
          > The font I am using has FC_SPACING set as PROPORTIONAL.<br>
          > So, Width of each character is different. I wanted to
          know, is it possible to get width of each character for a
          particular font in C i.e. using fontconfig.h ?<br>
          <br>
          Even if you change a value in FC_SPACING property, that won't
          change<br>
          the feel of "Width of each character is different" because
          that is the<br>
          reason why it was PROPORTIONAL. that is just a cache from a
          font to<br>
          query a best font against a request. that won't affect the
          rendering<br>
          directly.<br>
          <br>
          ><br>
          > Thank you for your time.<br>
          ><br>
          > Cheers<br>
          > Dheeraj<br>
          > _______________________________________________<br>
          > Fontconfig mailing list<br>
          > <a href="mailto:Fontconfig@lists.freedesktop.org"
            rel="noreferrer noreferrer noreferrer" target="_blank"
            moz-do-not-send="true">Fontconfig@lists.freedesktop.org</a><br>
          > <a
            href="https://lists.freedesktop.org/mailman/listinfo/fontconfig"
            rel="noreferrer noreferrer noreferrer noreferrer"
            target="_blank" moz-do-not-send="true">https://lists.freedesktop.org/mailman/listinfo/fontconfig</a><br>
          <br>
          <br>
          <br>
          -- <br>
          Akira TAGOH<br>
        </blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Fontconfig mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Fontconfig@lists.freedesktop.org">Fontconfig@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/fontconfig">https://lists.freedesktop.org/mailman/listinfo/fontconfig</a>
</pre>
    </blockquote>
  </body>
</html>