How to get depth and other lengths of a font?Fonts design parameters (descendent, cap height, etc): are they available in some register?Lengths and when to use themLengths and for-loopsA version of smash that interpolates between the true height/depth and the text-height/depth of the current lineHow to divide two lengths and get a result as an integer?Multicolumn within tabularx: how to get p'lengths' rightStop LaTeX adjusting vertical spacing when fitting more text onto a pageHow to set a length to the min of two other lengths?How to link 2 lengthsAdding lengths with the plus and minus syntaxIs there a way to update a length which has been computed from other lengths?

Do empty drive bays need to be filled?

Wizard clothing for warm weather

Does the Nuka-Cola bottler actually generate nuka cola?

As easy as Three, Two, One... How fast can you go from Five to Four?

Print "N NE E SE S SW W NW"

The origin of the Russian proverb about two hares

Tikz-cd diagram arrow passing under a node - not crossing it

Housemarks (superimposed & combined letters, heraldry)

The significance of kelvin as a unit of absolute temperature

Proving that a Russian cryptographic standard is too structured

Why ambiguous grammars are bad?

Command of files and size

What STL algorithm can determine if exactly one item in a container satisfies a predicate?

Cathode rays and the cathode rays tube

If there's something that implicates the president why is there then a national security issue? (John Dowd)

bash vs. zsh: What are the practical differences?

How was the airlock installed on the Space Shuttle mid deck?

Rail-to-rail op-amp only reaches 90% of VCC, works sometimes, not everytime

Are the guests in Westworld forbidden to tell the hosts that they are robots?

Do you have to have figures when playing D&D?

I've been given a project I can't complete, what should I do?

What do Birth, Age, and Death mean in the first noble truth?

What differences exist between adamantine and adamantite in all editions of D&D?

What would be the way to say "just saying" in German? (Not the literal translation)



How to get depth and other lengths of a font?


Fonts design parameters (descendent, cap height, etc): are they available in some register?Lengths and when to use themLengths and for-loopsA version of smash that interpolates between the true height/depth and the text-height/depth of the current lineHow to divide two lengths and get a result as an integer?Multicolumn within tabularx: how to get p'lengths' rightStop LaTeX adjusting vertical spacing when fitting more text onto a pageHow to set a length to the min of two other lengths?How to link 2 lengthsAdding lengths with the plus and minus syntaxIs there a way to update a length which has been computed from other lengths?













2















Red line in the output is baselineskip, the only length in question that I know of. The output image provided here is an edited image in which (red line representing baselineskip is re-positioned to start at the bottom of the top x) blue lines show the lengths I need to know.



documentclass[varwidth]standalone
usepackagexcolor
begindocument
fboxsep 0pt
fboxrule 0.1pt
fboxxyfMnewline
fboxxyfnewline
colorredvrule height baselineskip
enddocument











share|improve this question

















  • 1





    See also tex.stackexchange.com/questions/303483/…...

    – Rmano
    7 hours ago















2















Red line in the output is baselineskip, the only length in question that I know of. The output image provided here is an edited image in which (red line representing baselineskip is re-positioned to start at the bottom of the top x) blue lines show the lengths I need to know.



documentclass[varwidth]standalone
usepackagexcolor
begindocument
fboxsep 0pt
fboxrule 0.1pt
fboxxyfMnewline
fboxxyfnewline
colorredvrule height baselineskip
enddocument











share|improve this question

















  • 1





    See also tex.stackexchange.com/questions/303483/…...

    – Rmano
    7 hours ago













2












2








2








Red line in the output is baselineskip, the only length in question that I know of. The output image provided here is an edited image in which (red line representing baselineskip is re-positioned to start at the bottom of the top x) blue lines show the lengths I need to know.



documentclass[varwidth]standalone
usepackagexcolor
begindocument
fboxsep 0pt
fboxrule 0.1pt
fboxxyfMnewline
fboxxyfnewline
colorredvrule height baselineskip
enddocument











share|improve this question














Red line in the output is baselineskip, the only length in question that I know of. The output image provided here is an edited image in which (red line representing baselineskip is re-positioned to start at the bottom of the top x) blue lines show the lengths I need to know.



documentclass[varwidth]standalone
usepackagexcolor
begindocument
fboxsep 0pt
fboxrule 0.1pt
fboxxyfMnewline
fboxxyfnewline
colorredvrule height baselineskip
enddocument








spacing lengths






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 8 hours ago









bp2017bp2017

1,327316




1,327316







  • 1





    See also tex.stackexchange.com/questions/303483/…...

    – Rmano
    7 hours ago












  • 1





    See also tex.stackexchange.com/questions/303483/…...

    – Rmano
    7 hours ago







1




1





See also tex.stackexchange.com/questions/303483/…...

– Rmano
7 hours ago





See also tex.stackexchange.com/questions/303483/…...

– Rmano
7 hours ago










3 Answers
3






active

oldest

votes


















3














There is no way for TeX to know the exact size of the glyph, TeX only knows the box around them, so the small blue line at the f in the second row can't be determined by TeX alone. The other lengths are determinable, you can measure the size of any box you can typeset (the following is in plain TeX syntax):



setbox0hboxx
height: theht0par
depth: thedp0par
width: thewd0


With this you can determine the first blue line as:



setbox0hboxyf
distance between boxes: thedimexprbaselineskip-ht0-dp0relax


The blue lines above and below the x in the second row:



setbox0hboxx
setbox1hboxyf
distance above the x: thedimexprht1-ht0relaxpar
distance below the x: thedimexprdp1-dp0relax
bye


enter image description here






share|improve this answer
































    3














    e-tex allows you to get the font dimens of each charcter without needing to box it, this shows x and y of the current font



    documentclassarticle

    begindocument

    typeoutx
    showthefontcharhtfont`x
    showthefontchardpfont`x
    showthefontcharwdfont`x


    typeouty
    showthefontcharhtfont`y
    showthefontchardpfont`y
    showthefontcharwdfont`y
    enddocument


    making a log:



    x
    > 4.30554pt.
    l.8 showthefontcharhtfont`x

    ?
    > 0.0pt.
    l.9 showthefontchardpfont`x

    ?
    > 5.2778pt.
    l.10 showthefontcharwdfont`x

    ?
    y
    > 4.30554pt.
    l.14 showthefontcharhtfont`y

    ?
    > 1.94444pt.
    l.15 showthefontchardpfont`y

    ?
    > 5.2778pt.
    l.16 showthefontcharwdfont`y

    ?





    share|improve this answer

























    • oh, forgot about those three. You got your sources copied twice.

      – Skillmon
      8 hours ago



















    3














    The two distances marked with blue lines depend on the items in both lines, except the blue line next to “f”, which obviously only depends on the letter.



    So you can't “know” them in general.



    TeX tries to achieve constant distance b between consecutive lines (the value is stored in the parameter baselineskip). In order to achieve this goal, TeX measures a line (let's call it “line T”) and the next (call it “line B”, by determining the maximum depth d (how much a character extends below the baseline) in line T and the maximum height in line B.



    Then TeX computes bdh. If this turns out to be positive, then TeX will insert a glob of vertical glue of this amount between the two lines.



    Let's see an example:



    documentclassarticle

    begindocument

    typeoutdepth of y: thefontchardpfont`y

    typeoutheight of f: thefontcharhtfont`h

    hboxxyfMhboxxyf

    showoutput

    enddocument


    The relevant part of the log file is



    depth of y: 1.94444pt
    height of f: 6.94444pt
    [...]
    ...hbox(6.94444+1.94444)x22.77786
    ....OT1/cmr/m/n/10 x
    ....OT1/cmr/m/n/10 y
    ....OT1/cmr/m/n/10 f
    ....OT1/cmr/m/n/10 M
    ...glue(baselineskip) 3.11111
    ...hbox(6.94444+1.94444)x13.61118
    ....OT1/cmr/m/n/10 x
    ....OT1/cmr/m/n/10 y
    ....OT1/cmr/m/n/10 f


    As you see, the depth of y is reflected in the depth of line T, namely hbox(6.94444+1.94444)x22.77786; the height of f corresponds to the height of line B, namely hbox(6.94444+1.94444)x13.61118.



    If we try 1.94444+6.94444+3.11111 we get 11.99999, which to TeX is the same as 12pt; actually typeoutthedimexpr1.94444pt+6.94444pt+3.11111pt would print 12.0pt on the console.



    However, if bdh is less than the value stored in lineskiplimit (default is 0pt), instead of the computed glue, TeX inserts a fixed amount using the value stored in lineskip (default 1pt), so that lines never overlap with each other (in the standard setup). By using suitable values of lineskiplimit and lineskip one can actually get lines that superimpose to each other, never filling a page (this is exploited in the ooalign macro).



    The usage of hbox might seem unrealistic, but actually TeX makes hboxes after splitting a paragraph into lines.



    The amount by which a glyph extends outside its bounding box is unknown to TeX and irrelevant for its computations, which only use the bounding box, characterized by height, depth and width.



    XeTeX has a primitive to do such measurements, namely XeTeXglyphbounds; look for it in the XeTeX reference (texdoc xetex).






    share|improve this answer























      Your Answer








      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "85"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f495009%2fhow-to-get-depth-and-other-lengths-of-a-font%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      3














      There is no way for TeX to know the exact size of the glyph, TeX only knows the box around them, so the small blue line at the f in the second row can't be determined by TeX alone. The other lengths are determinable, you can measure the size of any box you can typeset (the following is in plain TeX syntax):



      setbox0hboxx
      height: theht0par
      depth: thedp0par
      width: thewd0


      With this you can determine the first blue line as:



      setbox0hboxyf
      distance between boxes: thedimexprbaselineskip-ht0-dp0relax


      The blue lines above and below the x in the second row:



      setbox0hboxx
      setbox1hboxyf
      distance above the x: thedimexprht1-ht0relaxpar
      distance below the x: thedimexprdp1-dp0relax
      bye


      enter image description here






      share|improve this answer





























        3














        There is no way for TeX to know the exact size of the glyph, TeX only knows the box around them, so the small blue line at the f in the second row can't be determined by TeX alone. The other lengths are determinable, you can measure the size of any box you can typeset (the following is in plain TeX syntax):



        setbox0hboxx
        height: theht0par
        depth: thedp0par
        width: thewd0


        With this you can determine the first blue line as:



        setbox0hboxyf
        distance between boxes: thedimexprbaselineskip-ht0-dp0relax


        The blue lines above and below the x in the second row:



        setbox0hboxx
        setbox1hboxyf
        distance above the x: thedimexprht1-ht0relaxpar
        distance below the x: thedimexprdp1-dp0relax
        bye


        enter image description here






        share|improve this answer



























          3












          3








          3







          There is no way for TeX to know the exact size of the glyph, TeX only knows the box around them, so the small blue line at the f in the second row can't be determined by TeX alone. The other lengths are determinable, you can measure the size of any box you can typeset (the following is in plain TeX syntax):



          setbox0hboxx
          height: theht0par
          depth: thedp0par
          width: thewd0


          With this you can determine the first blue line as:



          setbox0hboxyf
          distance between boxes: thedimexprbaselineskip-ht0-dp0relax


          The blue lines above and below the x in the second row:



          setbox0hboxx
          setbox1hboxyf
          distance above the x: thedimexprht1-ht0relaxpar
          distance below the x: thedimexprdp1-dp0relax
          bye


          enter image description here






          share|improve this answer















          There is no way for TeX to know the exact size of the glyph, TeX only knows the box around them, so the small blue line at the f in the second row can't be determined by TeX alone. The other lengths are determinable, you can measure the size of any box you can typeset (the following is in plain TeX syntax):



          setbox0hboxx
          height: theht0par
          depth: thedp0par
          width: thewd0


          With this you can determine the first blue line as:



          setbox0hboxyf
          distance between boxes: thedimexprbaselineskip-ht0-dp0relax


          The blue lines above and below the x in the second row:



          setbox0hboxx
          setbox1hboxyf
          distance above the x: thedimexprht1-ht0relaxpar
          distance below the x: thedimexprdp1-dp0relax
          bye


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 8 hours ago

























          answered 8 hours ago









          SkillmonSkillmon

          25.7k12553




          25.7k12553





















              3














              e-tex allows you to get the font dimens of each charcter without needing to box it, this shows x and y of the current font



              documentclassarticle

              begindocument

              typeoutx
              showthefontcharhtfont`x
              showthefontchardpfont`x
              showthefontcharwdfont`x


              typeouty
              showthefontcharhtfont`y
              showthefontchardpfont`y
              showthefontcharwdfont`y
              enddocument


              making a log:



              x
              > 4.30554pt.
              l.8 showthefontcharhtfont`x

              ?
              > 0.0pt.
              l.9 showthefontchardpfont`x

              ?
              > 5.2778pt.
              l.10 showthefontcharwdfont`x

              ?
              y
              > 4.30554pt.
              l.14 showthefontcharhtfont`y

              ?
              > 1.94444pt.
              l.15 showthefontchardpfont`y

              ?
              > 5.2778pt.
              l.16 showthefontcharwdfont`y

              ?





              share|improve this answer

























              • oh, forgot about those three. You got your sources copied twice.

                – Skillmon
                8 hours ago
















              3














              e-tex allows you to get the font dimens of each charcter without needing to box it, this shows x and y of the current font



              documentclassarticle

              begindocument

              typeoutx
              showthefontcharhtfont`x
              showthefontchardpfont`x
              showthefontcharwdfont`x


              typeouty
              showthefontcharhtfont`y
              showthefontchardpfont`y
              showthefontcharwdfont`y
              enddocument


              making a log:



              x
              > 4.30554pt.
              l.8 showthefontcharhtfont`x

              ?
              > 0.0pt.
              l.9 showthefontchardpfont`x

              ?
              > 5.2778pt.
              l.10 showthefontcharwdfont`x

              ?
              y
              > 4.30554pt.
              l.14 showthefontcharhtfont`y

              ?
              > 1.94444pt.
              l.15 showthefontchardpfont`y

              ?
              > 5.2778pt.
              l.16 showthefontcharwdfont`y

              ?





              share|improve this answer

























              • oh, forgot about those three. You got your sources copied twice.

                – Skillmon
                8 hours ago














              3












              3








              3







              e-tex allows you to get the font dimens of each charcter without needing to box it, this shows x and y of the current font



              documentclassarticle

              begindocument

              typeoutx
              showthefontcharhtfont`x
              showthefontchardpfont`x
              showthefontcharwdfont`x


              typeouty
              showthefontcharhtfont`y
              showthefontchardpfont`y
              showthefontcharwdfont`y
              enddocument


              making a log:



              x
              > 4.30554pt.
              l.8 showthefontcharhtfont`x

              ?
              > 0.0pt.
              l.9 showthefontchardpfont`x

              ?
              > 5.2778pt.
              l.10 showthefontcharwdfont`x

              ?
              y
              > 4.30554pt.
              l.14 showthefontcharhtfont`y

              ?
              > 1.94444pt.
              l.15 showthefontchardpfont`y

              ?
              > 5.2778pt.
              l.16 showthefontcharwdfont`y

              ?





              share|improve this answer















              e-tex allows you to get the font dimens of each charcter without needing to box it, this shows x and y of the current font



              documentclassarticle

              begindocument

              typeoutx
              showthefontcharhtfont`x
              showthefontchardpfont`x
              showthefontcharwdfont`x


              typeouty
              showthefontcharhtfont`y
              showthefontchardpfont`y
              showthefontcharwdfont`y
              enddocument


              making a log:



              x
              > 4.30554pt.
              l.8 showthefontcharhtfont`x

              ?
              > 0.0pt.
              l.9 showthefontchardpfont`x

              ?
              > 5.2778pt.
              l.10 showthefontcharwdfont`x

              ?
              y
              > 4.30554pt.
              l.14 showthefontcharhtfont`y

              ?
              > 1.94444pt.
              l.15 showthefontchardpfont`y

              ?
              > 5.2778pt.
              l.16 showthefontcharwdfont`y

              ?






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited 7 hours ago

























              answered 8 hours ago









              David CarlisleDavid Carlisle

              509k4311591915




              509k4311591915












              • oh, forgot about those three. You got your sources copied twice.

                – Skillmon
                8 hours ago


















              • oh, forgot about those three. You got your sources copied twice.

                – Skillmon
                8 hours ago

















              oh, forgot about those three. You got your sources copied twice.

              – Skillmon
              8 hours ago






              oh, forgot about those three. You got your sources copied twice.

              – Skillmon
              8 hours ago












              3














              The two distances marked with blue lines depend on the items in both lines, except the blue line next to “f”, which obviously only depends on the letter.



              So you can't “know” them in general.



              TeX tries to achieve constant distance b between consecutive lines (the value is stored in the parameter baselineskip). In order to achieve this goal, TeX measures a line (let's call it “line T”) and the next (call it “line B”, by determining the maximum depth d (how much a character extends below the baseline) in line T and the maximum height in line B.



              Then TeX computes bdh. If this turns out to be positive, then TeX will insert a glob of vertical glue of this amount between the two lines.



              Let's see an example:



              documentclassarticle

              begindocument

              typeoutdepth of y: thefontchardpfont`y

              typeoutheight of f: thefontcharhtfont`h

              hboxxyfMhboxxyf

              showoutput

              enddocument


              The relevant part of the log file is



              depth of y: 1.94444pt
              height of f: 6.94444pt
              [...]
              ...hbox(6.94444+1.94444)x22.77786
              ....OT1/cmr/m/n/10 x
              ....OT1/cmr/m/n/10 y
              ....OT1/cmr/m/n/10 f
              ....OT1/cmr/m/n/10 M
              ...glue(baselineskip) 3.11111
              ...hbox(6.94444+1.94444)x13.61118
              ....OT1/cmr/m/n/10 x
              ....OT1/cmr/m/n/10 y
              ....OT1/cmr/m/n/10 f


              As you see, the depth of y is reflected in the depth of line T, namely hbox(6.94444+1.94444)x22.77786; the height of f corresponds to the height of line B, namely hbox(6.94444+1.94444)x13.61118.



              If we try 1.94444+6.94444+3.11111 we get 11.99999, which to TeX is the same as 12pt; actually typeoutthedimexpr1.94444pt+6.94444pt+3.11111pt would print 12.0pt on the console.



              However, if bdh is less than the value stored in lineskiplimit (default is 0pt), instead of the computed glue, TeX inserts a fixed amount using the value stored in lineskip (default 1pt), so that lines never overlap with each other (in the standard setup). By using suitable values of lineskiplimit and lineskip one can actually get lines that superimpose to each other, never filling a page (this is exploited in the ooalign macro).



              The usage of hbox might seem unrealistic, but actually TeX makes hboxes after splitting a paragraph into lines.



              The amount by which a glyph extends outside its bounding box is unknown to TeX and irrelevant for its computations, which only use the bounding box, characterized by height, depth and width.



              XeTeX has a primitive to do such measurements, namely XeTeXglyphbounds; look for it in the XeTeX reference (texdoc xetex).






              share|improve this answer



























                3














                The two distances marked with blue lines depend on the items in both lines, except the blue line next to “f”, which obviously only depends on the letter.



                So you can't “know” them in general.



                TeX tries to achieve constant distance b between consecutive lines (the value is stored in the parameter baselineskip). In order to achieve this goal, TeX measures a line (let's call it “line T”) and the next (call it “line B”, by determining the maximum depth d (how much a character extends below the baseline) in line T and the maximum height in line B.



                Then TeX computes bdh. If this turns out to be positive, then TeX will insert a glob of vertical glue of this amount between the two lines.



                Let's see an example:



                documentclassarticle

                begindocument

                typeoutdepth of y: thefontchardpfont`y

                typeoutheight of f: thefontcharhtfont`h

                hboxxyfMhboxxyf

                showoutput

                enddocument


                The relevant part of the log file is



                depth of y: 1.94444pt
                height of f: 6.94444pt
                [...]
                ...hbox(6.94444+1.94444)x22.77786
                ....OT1/cmr/m/n/10 x
                ....OT1/cmr/m/n/10 y
                ....OT1/cmr/m/n/10 f
                ....OT1/cmr/m/n/10 M
                ...glue(baselineskip) 3.11111
                ...hbox(6.94444+1.94444)x13.61118
                ....OT1/cmr/m/n/10 x
                ....OT1/cmr/m/n/10 y
                ....OT1/cmr/m/n/10 f


                As you see, the depth of y is reflected in the depth of line T, namely hbox(6.94444+1.94444)x22.77786; the height of f corresponds to the height of line B, namely hbox(6.94444+1.94444)x13.61118.



                If we try 1.94444+6.94444+3.11111 we get 11.99999, which to TeX is the same as 12pt; actually typeoutthedimexpr1.94444pt+6.94444pt+3.11111pt would print 12.0pt on the console.



                However, if bdh is less than the value stored in lineskiplimit (default is 0pt), instead of the computed glue, TeX inserts a fixed amount using the value stored in lineskip (default 1pt), so that lines never overlap with each other (in the standard setup). By using suitable values of lineskiplimit and lineskip one can actually get lines that superimpose to each other, never filling a page (this is exploited in the ooalign macro).



                The usage of hbox might seem unrealistic, but actually TeX makes hboxes after splitting a paragraph into lines.



                The amount by which a glyph extends outside its bounding box is unknown to TeX and irrelevant for its computations, which only use the bounding box, characterized by height, depth and width.



                XeTeX has a primitive to do such measurements, namely XeTeXglyphbounds; look for it in the XeTeX reference (texdoc xetex).






                share|improve this answer

























                  3












                  3








                  3







                  The two distances marked with blue lines depend on the items in both lines, except the blue line next to “f”, which obviously only depends on the letter.



                  So you can't “know” them in general.



                  TeX tries to achieve constant distance b between consecutive lines (the value is stored in the parameter baselineskip). In order to achieve this goal, TeX measures a line (let's call it “line T”) and the next (call it “line B”, by determining the maximum depth d (how much a character extends below the baseline) in line T and the maximum height in line B.



                  Then TeX computes bdh. If this turns out to be positive, then TeX will insert a glob of vertical glue of this amount between the two lines.



                  Let's see an example:



                  documentclassarticle

                  begindocument

                  typeoutdepth of y: thefontchardpfont`y

                  typeoutheight of f: thefontcharhtfont`h

                  hboxxyfMhboxxyf

                  showoutput

                  enddocument


                  The relevant part of the log file is



                  depth of y: 1.94444pt
                  height of f: 6.94444pt
                  [...]
                  ...hbox(6.94444+1.94444)x22.77786
                  ....OT1/cmr/m/n/10 x
                  ....OT1/cmr/m/n/10 y
                  ....OT1/cmr/m/n/10 f
                  ....OT1/cmr/m/n/10 M
                  ...glue(baselineskip) 3.11111
                  ...hbox(6.94444+1.94444)x13.61118
                  ....OT1/cmr/m/n/10 x
                  ....OT1/cmr/m/n/10 y
                  ....OT1/cmr/m/n/10 f


                  As you see, the depth of y is reflected in the depth of line T, namely hbox(6.94444+1.94444)x22.77786; the height of f corresponds to the height of line B, namely hbox(6.94444+1.94444)x13.61118.



                  If we try 1.94444+6.94444+3.11111 we get 11.99999, which to TeX is the same as 12pt; actually typeoutthedimexpr1.94444pt+6.94444pt+3.11111pt would print 12.0pt on the console.



                  However, if bdh is less than the value stored in lineskiplimit (default is 0pt), instead of the computed glue, TeX inserts a fixed amount using the value stored in lineskip (default 1pt), so that lines never overlap with each other (in the standard setup). By using suitable values of lineskiplimit and lineskip one can actually get lines that superimpose to each other, never filling a page (this is exploited in the ooalign macro).



                  The usage of hbox might seem unrealistic, but actually TeX makes hboxes after splitting a paragraph into lines.



                  The amount by which a glyph extends outside its bounding box is unknown to TeX and irrelevant for its computations, which only use the bounding box, characterized by height, depth and width.



                  XeTeX has a primitive to do such measurements, namely XeTeXglyphbounds; look for it in the XeTeX reference (texdoc xetex).






                  share|improve this answer













                  The two distances marked with blue lines depend on the items in both lines, except the blue line next to “f”, which obviously only depends on the letter.



                  So you can't “know” them in general.



                  TeX tries to achieve constant distance b between consecutive lines (the value is stored in the parameter baselineskip). In order to achieve this goal, TeX measures a line (let's call it “line T”) and the next (call it “line B”, by determining the maximum depth d (how much a character extends below the baseline) in line T and the maximum height in line B.



                  Then TeX computes bdh. If this turns out to be positive, then TeX will insert a glob of vertical glue of this amount between the two lines.



                  Let's see an example:



                  documentclassarticle

                  begindocument

                  typeoutdepth of y: thefontchardpfont`y

                  typeoutheight of f: thefontcharhtfont`h

                  hboxxyfMhboxxyf

                  showoutput

                  enddocument


                  The relevant part of the log file is



                  depth of y: 1.94444pt
                  height of f: 6.94444pt
                  [...]
                  ...hbox(6.94444+1.94444)x22.77786
                  ....OT1/cmr/m/n/10 x
                  ....OT1/cmr/m/n/10 y
                  ....OT1/cmr/m/n/10 f
                  ....OT1/cmr/m/n/10 M
                  ...glue(baselineskip) 3.11111
                  ...hbox(6.94444+1.94444)x13.61118
                  ....OT1/cmr/m/n/10 x
                  ....OT1/cmr/m/n/10 y
                  ....OT1/cmr/m/n/10 f


                  As you see, the depth of y is reflected in the depth of line T, namely hbox(6.94444+1.94444)x22.77786; the height of f corresponds to the height of line B, namely hbox(6.94444+1.94444)x13.61118.



                  If we try 1.94444+6.94444+3.11111 we get 11.99999, which to TeX is the same as 12pt; actually typeoutthedimexpr1.94444pt+6.94444pt+3.11111pt would print 12.0pt on the console.



                  However, if bdh is less than the value stored in lineskiplimit (default is 0pt), instead of the computed glue, TeX inserts a fixed amount using the value stored in lineskip (default 1pt), so that lines never overlap with each other (in the standard setup). By using suitable values of lineskiplimit and lineskip one can actually get lines that superimpose to each other, never filling a page (this is exploited in the ooalign macro).



                  The usage of hbox might seem unrealistic, but actually TeX makes hboxes after splitting a paragraph into lines.



                  The amount by which a glyph extends outside its bounding box is unknown to TeX and irrelevant for its computations, which only use the bounding box, characterized by height, depth and width.



                  XeTeX has a primitive to do such measurements, namely XeTeXglyphbounds; look for it in the XeTeX reference (texdoc xetex).







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 7 hours ago









                  egregegreg

                  747k8919543296




                  747k8919543296



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f495009%2fhow-to-get-depth-and-other-lengths-of-a-font%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

                      Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

                      Ласкавець круглолистий Зміст Опис | Поширення | Галерея | Примітки | Посилання | Навігаційне меню58171138361-22960890446Bupleurum rotundifoliumEuro+Med PlantbasePlants of the World Online — Kew ScienceGermplasm Resources Information Network (GRIN)Ласкавецькн. VI : Літери Ком — Левиправивши або дописавши її