Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing font issue #388

Merged
merged 6 commits into from
Feb 26, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ see CHANGELOG.md for a more formal list of changes by release
* log pane, bug, the text 'catalogue' is being truncated in multi-line messages
- see screenshot Screenshot at 2022-09-24 08-56-35.png

* dark theme, 'wow' column text is black on black for some reason

## todo bucket (no particular order)

* wowinterface, fetch addon data from secondary source
Expand Down
Binary file added resources/fontawesome-4.7.0.ttf
Binary file not shown.
21 changes: 18 additions & 3 deletions src/strongbox/constants.clj
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,31 @@
;; like during testing the formatting of date durations.
(def fake-date "2001-01-01")

(def glyph-map
(def glyph-map--regular
{:tick "\u2714" ;; '✔'
:unsteady "\u2941" ;; '⥁' CLOCKWISE CLOSED CIRCLE ARROW
:warnings "\u2501" ;; '━' heavy horizontal
:errors "\u2A2F" ;; '⨯'
:update "\u21A6" ;; '↦'
:errors "\u2A2F" ;; '⨯' vector or cross product
:update "\u21A6" ;; '↦' rightwards arrow from bar
:ignored "\u26AA" ;; '⚪' medium white circle
:pinned "\u26ab" ;; '⚫' medium black circle
:star "\u2605" ;; '★' black star
})

(def glyph-map--fontawesome
{:tick "\uf00c"
:unsteady "\uf021"
:warnings "\uf068"
:errors "\uf00d"
:update "\uf061" ;; arrow_right
:ignored "\uf056"
;;:pinned "\uf08d" ;; '⚫' medium black circle
:pinned "\uf192"
:star "\uf005" ;; '★' black star
torkus marked this conversation as resolved.
Show resolved Hide resolved
})

(def glyph-map glyph-map--fontawesome)

(def curseforge-cutoff-label "Feb 1st, 2022")

(def releases
Expand Down
27 changes: 19 additions & 8 deletions src/strongbox/jfx.clj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
[utils :as utils :refer [no-new-lines message-list]]
[core :as core]])
(:import
[javafx.scene.text Font]
[java.util List Calendar Locale]
[javafx.util Callback]
[javafx.scene.control TreeTableRow TableRow TextInputDialog Alert Alert$AlertType ButtonType]
Expand All @@ -38,6 +39,15 @@
[javafx.event Event]
[java.text NumberFormat]))

(defn load-font-from-resources
torkus marked this conversation as resolved.
Show resolved Hide resolved
[resource]
(-> resource
clojure.java.io/resource
str
(Font/loadFont 40.0)))

(def embedded-font (load-font-from-resources "fontawesome-4.7.0.ttf"))

;; javafx hack, fixes combobox that sometimes goes blank:
;; - https://github.com/cljfx/cljfx/issues/76#issuecomment-645563116
(def ext-recreate-on-key-changed
Expand Down Expand Up @@ -388,9 +398,10 @@
{:-fx-alignment "center"}

".uber-button"
{:-fx-font-size "1.5em"
{:-fx-font-size "1.3em"
:-fx-padding "1 0"
:-fx-text-fill (colour :uber-button-tick) ;; green tick
:-fx-font-weight "bold"}
:-fx-font-family "'FontAwesome'"}

".table-row-cell.warnings .invisible-button-column > .uber-button"
{;; orange bar
Expand Down Expand Up @@ -485,8 +496,8 @@
{:-fx-text-fill (colour :star-hover)}

".star-column > .button"
{:-fx-padding "-0.25em !important"
:-fx-font-size "1.9em"
{:-fx-padding "1 0"
:-fx-font-size "1.3em"
:-fx-text-fill (colour :star-unstarred)

".starred"
Expand All @@ -500,8 +511,8 @@

"#search-user-catalogue-button"
{:-fx-font-weight "bold"
:-fx-font-size "1.4em"
:-fx-padding "1 7"
:-fx-font-size "1.2em"
:-fx-padding "2 7 "

".starred" {:-fx-text-fill (colour :star-starred)
;; the yellow of the star doesn't stand out from the gray gradient behind it.
Expand Down Expand Up @@ -1876,7 +1887,7 @@
:describe (fn [addon-summary]
(let [starred (starred? addon-summary)
f (if starred cli/remove-summary-from-user-catalogue cli/add-summary-to-user-catalogue)]
{:graphic (button "\u2605"
{:graphic (button (:star constants/glyph-map)
(async-handler (partial f addon-summary))
{:style-class (if starred "starred" "unstarred")})}))}}

Expand Down Expand Up @@ -1977,7 +1988,7 @@
:text (core/get-state :search :term) ;; this seems ok, probably has it's own drawbacks
:on-text-changed cli/search}

(button "\u2605" (async-handler #(cli/search-toggle-filter :user-catalogue))
(button (:star constants/glyph-map) (async-handler #(cli/search-toggle-filter :user-catalogue))
{:id "search-user-catalogue-button"
:style-class (if (-> search-state :filter-by :user-catalogue) "starred" "unstarred")})

Expand Down