add more fonts

This commit is contained in:
jrkb 2023-04-04 09:37:06 +02:00
parent 2d22e8b61d
commit c37729e0ba
2 changed files with 63 additions and 3 deletions

View file

@ -35,11 +35,11 @@ bla bla bla
//-------------------------------------------------------------- //--------------------------------------------------------------
void ofApp::setup(){ void ofApp::setup(){
mainText_full = "A"; mainText_full = "A";
mainText = R"DONE(abcdefghijklmnopqrstuvqxyz mainText_full = R"DONE(abcdefghijklmnopqrstuvqxyz
ABCDEFGHIJKLMNOP)DONE"; ABCDEFGHIJKLMNOP)DONE";
//QRSTUVWXYZ //QRSTUVWXYZ
//0123456789",.!@#$%^&*()_+=-[]{})DONE"; //0123456789",.!@#$%^&*()_+=-[]{})DONE";
mainText_full = R"DONE(Some things are hard to write about. Take soil, mainText = R"DONE(Some things are hard to write about. Take soil,
for instance. Soil, Oxford dictionary reads, is the for instance. Soil, Oxford dictionary reads, is the
upper layer of earth in which plants grow, a black or upper layer of earth in which plants grow, a black or
dark brown material typically consisting of a mixture dark brown material typically consisting of a mixture
@ -206,7 +206,10 @@ void ofApp::draw(){
glDisable(GL_BLEND); glDisable(GL_BLEND);
ofDrawBitmapStringHighlight("fps: " + ofToString(ofGetFrameRate()), 20, 20); ofDrawBitmapStringHighlight(
"fps: " + ofToString(ofGetFrameRate()) + "\n"
+ "font: " + currentFontPath + "\n"
, 20, 20);
backgroundColor = ofFloatColor::pink; backgroundColor = ofFloatColor::pink;
} }
@ -233,6 +236,19 @@ void ofApp::keyReleased(int key){
if(key == 'c'){ if(key == 'c'){
enableControlPointsVisualization = !enableControlPointsVisualization; enableControlPointsVisualization = !enableControlPointsVisualization;
} }
if(key == '=' || key == '-'){
if(key == '='){
fontIndex = (fontIndex + 1 + fonts.size()) % fonts.size();
}else{
fontIndex = (fontIndex - 1 + fonts.size()) % fonts.size();
}
currentFontPath = fonts[fontIndex];
tryUpdateMainFont(library,
currentFontPath,
mainText,
font,
bb);
}
} }
//-------------------------------------------------------------- //--------------------------------------------------------------

View file

@ -106,4 +106,48 @@ class ofApp : public ofBaseApp {
ofFloatColor backgroundColor; ofFloatColor backgroundColor;
GLuint fontShaderProgram; GLuint fontShaderProgram;
int fontIndex = -1;
vector <string> fonts = {
"data/fonts/RobotoFlex.ttf",
"data/fonts/Akshar-VariableFont_wght.ttf",
"data/fonts/Batang.ttf",
"data/fonts/CarmenisTrial-Regular.ttf*",
"data/fonts/castaway.ttf",
"data/fonts/cooperBlack.ttf",
"data/fonts/DENMARK.TTF",
"data/fonts/frabk.ttf",
"data/fonts/glyphicons-halflings-regular.ttf",
"data/fonts/icons.ttf*",
"data/fonts/LiberationMono-Regular.ttf*",
"data/fonts/Lilian-Ampersand-beta-0321-Regular.ttf*",
"data/fonts/mono0755.ttf",
"data/fonts/mono.ttf",
"data/fonts/Questrial-Regular.ttf",
"data/fonts/RobotoFlex.ttf",
"data/fonts/Sudbury_Basin_3D.ttf",
"data/fonts/vag.ttf",
"data/fonts/verdana.ttf",
"data/celines-fonts/Alfarn2.otf",
"data/celines-fonts/Lilian-Ampersand-beta-0321-Regular.ttf",
"data/celines-fonts/Tonka-1221-Regular.otf",
"data/celines-fonts/Tonka_Beta_02-RegularExtended.ttf",
"data/celines-fonts/Tonka-metrics-10-Regular.ttf",
"data/celines-fonts/Version-4-var.ttf",
"data/celines-fonts/CarmenisTrial-Regular.ttf",
"data/celines-fonts/Rudi15-1.otf",
"data/celines-fonts/Tonka_Beta_02-DemiExtended.ttf",
"data/celines-fonts/Tonka_Beta_02-SemiExtended.ttf",
"data/celines-fonts/Version-1-var.ttf",
"data/celines-fonts/Cottagecore.ttf",
"data/celines-fonts/testing2VF.ttf",
"data/celines-fonts/Tonka_Beta_02-ExtraExtended.ttf",
"data/celines-fonts/Tonka_Beta_02-UltraExtended.ttf",
"data/celines-fonts/Version-2-var.ttf",
"data/celines-fonts/DarkAcademia-Regular.ttf",
"data/celines-fonts/Tonka-1221GX.ttf",
"data/celines-fonts/Tonka_Beta_02-MediumExtended.ttf",
"data/celines-fonts/tonkaflowers-Regular.otf",
"data/celines-fonts/Version-3-var.ttf"
};
}; };