Monospace Font Consoles with Height 15px and Width 7px

0

I'm trying to figure out how I can have a font size that is always exactly 7 pixels wide and 15 high in all letters / charateres.

I thought font-family: consolas; with font-size: 12.73px; was perfect but after testing more accurately (by calculating the size of 100 characters) I discovered the following:

function Atualizar(){
  document.getElementById('Font').style.fontSize = document.getElementById('Input').value + "px";
  document.getElementById('Horizontal').innerHTML = document.getElementById('Font').getBoundingClientRect().width;
  document.getElementById('Vertical').innerHTML = document.getElementById('Font').getBoundingClientRect().height;
}
Atualizar()
span {
  font-family: consolas;
}
<span id="Font">1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890</span>
<br>
<br>
<span>Tamanho da font: </span><input id="Input" oninput="Atualizar()" value="12.739999294281004971196">
<br>
<span>Largura de 100 caratere: </span><span id="Horizontal"></span>
<br>
<span>Altura de 1 carateres: </span><span id="Vertical"></span>

Note: after writing, reading and listening to both English online, I no longer have an idea if I write in English character, character, character, characters, characters, etc. I'm reading caratere and characters (lyrics).

    
asked by anonymous 07.03.2017 / 10:30

1 answer

0

I also I asked this question in StackOverflow English and I received the #

Even though, if someone still has a better answer, I'm grateful.

This is something that annoys me a lot but not so much now with this trick.

I'm creating a text editor that will use a lot of JavaScript and automatic placement.

    
07.03.2017 / 12:36