font text ptroot

This commit is contained in:
hugogogo
2021-05-18 11:32:39 +02:00
parent ce89086702
commit f8f77feee7
2 changed files with 21 additions and 12 deletions

View File

@@ -10,29 +10,37 @@ function fonts()
// go to the div "nav"
let nav = document.getElementsByClassName("nav_left");
// list the names of the fonts in fonts.css
let fontName = list_fonts();
// add an anchor
let anchor = document.createElement("a");
anchor.setAttribute('id', "fonts");
nav[0].appendChild(anchor);
/*---------------------------*/
// manually write list of fonts
anchor.innerHTML = `
<p>fonts</p>
<div id="fonts_dropdown">
<button onclick="change_font()">louisgeorge (defaut)</button>
<button onclick="change_font()">cabrion</button>
<button onclick="change_font()">ptroot (defaut)</button>
<button onclick="change_font()">paradroid (titres)</button>
<button onclick="change_font()">evolvanta</button>
<button onclick="change_font()">ptroot</button>
<button onclick="change_font()">cabrion</button>
<button onclick="change_font()">louisgeorge</button>
<button onclick="change_font()">evolventa</button>
<button onclick="change_font()">tgalcefun</button>
<button onclick="change_font()">bentonsansbook (payant)</button>
<button onclick="change_font()">larsseitlight (payant)</button>
<button onclick="change_font()">bentonsansbook</button>
<button onclick="change_font()">larsseitlight</button>
</div>
`;
/*-------------------------------------*/
// or automatically write list of fonts :
/*
// list the names of the fonts in fonts.css
// first solution with a complicated function :
let fontName = list_fonts();
// or with this really easy function :
let list_my_fonts = Array.from(document.fonts);
// add the buttons automatically
let p_font = document.createElement("p");
p_font.innerHTML = "fonts";
@@ -58,6 +66,7 @@ function change_font()
document.documentElement.style.cssText = "--font-texts: " + name;
}
/*
function list_fonts()
{
// get all style sheets
@@ -72,5 +81,5 @@ function list_fonts()
let fontName = Object.values(fontRules).map(val => val.cssText.match(/(?<=font-family: ").+?(?=")/));
return fontName;
}
*/

View File

@@ -43,8 +43,8 @@
/*TEXTE*/
/* fonts */
--font-titles: 'paradroid';
--font-texts: 'louisgeorge';
--font-fallback: 'cabrion';
--font-texts: 'ptroot';
--font-fallback: 'louisgeorge';
/* colors texts */