From c37729e0ba7bfe8413cf807b1b5d4ec865a4cd79 Mon Sep 17 00:00:00 2001 From: themancalledjakob Date: Tue, 4 Apr 2023 09:37:06 +0200 Subject: [PATCH] add more fonts --- example/src/ofApp.cpp | 22 +++++++++++++++++++--- example/src/ofApp.h | 44 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 3 deletions(-) diff --git a/example/src/ofApp.cpp b/example/src/ofApp.cpp index 9e772f3..306c3a2 100644 --- a/example/src/ofApp.cpp +++ b/example/src/ofApp.cpp @@ -35,11 +35,11 @@ bla bla bla //-------------------------------------------------------------- void ofApp::setup(){ mainText_full = "A"; - mainText = R"DONE(abcdefghijklmnopqrstuvqxyz + mainText_full = R"DONE(abcdefghijklmnopqrstuvqxyz ABCDEFGHIJKLMNOP)DONE"; //QRSTUVWXYZ //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 upper layer of earth in which plants grow, a black or dark brown material typically consisting of a mixture @@ -206,7 +206,10 @@ void ofApp::draw(){ glDisable(GL_BLEND); - ofDrawBitmapStringHighlight("fps: " + ofToString(ofGetFrameRate()), 20, 20); + ofDrawBitmapStringHighlight( + "fps: " + ofToString(ofGetFrameRate()) + "\n" + + "font: " + currentFontPath + "\n" + , 20, 20); backgroundColor = ofFloatColor::pink; } @@ -233,6 +236,19 @@ void ofApp::keyReleased(int key){ if(key == 'c'){ 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); + } } //-------------------------------------------------------------- diff --git a/example/src/ofApp.h b/example/src/ofApp.h index 4cb25d8..3319e5e 100644 --- a/example/src/ofApp.h +++ b/example/src/ofApp.h @@ -106,4 +106,48 @@ class ofApp : public ofBaseApp { ofFloatColor backgroundColor; GLuint fontShaderProgram; + + int fontIndex = -1; + vector 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" + }; };