Skip to content

Commit

Permalink
Merge pull request #388 from ogri-la/font-missing-issue
Browse files Browse the repository at this point in the history
missing font issue
  • Loading branch information
torkus authored Feb 26, 2023
2 parents 011191b + 43876e3 commit b660555
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 15 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

* embedded font for glyphs used in the uber and star buttons for systems running with minimal fonts.
- https://github.com/ogri-la/strongbox/issues/384

### Changed

* glyphs used for the uber and star buttons switched to their close equivalents in the new embedded font
- they're a little chunkier now but also look a little better in my estimation.

### Fixed

### Removed
Expand Down
9 changes: 7 additions & 2 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ see CHANGELOG.md for a more formal list of changes by release

## done

* fonts are screwy on some systems
- https://github.com/ogri-la/strongbox/issues/384
- embedded an older, smaller, lighter fontawesome and switched the glyphs
- done

## todo

* add support for cloning git repositories
Expand All @@ -24,12 +29,12 @@ see CHANGELOG.md for a more formal list of changes by release
- how about a shallow clone?
- just the files are cloned to a directory

* fonts are screwy on some systems
- https://github.com/ogri-la/strongbox/issues/384

* 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.
22 changes: 19 additions & 3 deletions src/strongbox/constants.clj
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,32 @@
;; 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
:right-arrow "\u2794" ;; '➔' HEAVY WIDE-HEADED RIGHTWARDS ARROW
})

(def glyph-map--fontawesome
{:tick "\uf00c" ;; check
:unsteady "\uf021" ;; arrows rotate
:warnings "\uf068" ;; minus
:errors "\uf00d" ;; xmark
:update "\uf061" ;; arrow-right
:ignored "\uf056" ;; circle minus
:pinned "\uf192" ;; circle dot
:star "\uf005" ;; star
:right-arrow "\uf061" ;; arrow-right
})

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

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

(def releases
Expand Down
31 changes: 21 additions & 10 deletions src/strongbox/jfx.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[me.raynes.fs :as fs]
[clojure.pprint]
[clojure.set]
[clojure.java.io :as io]
;;[clojure.core.cache :as cache]
[clojure.string :refer [lower-case join capitalize replace] :rename {replace str-replace}]
;; logging in the gui should be avoided as it can lead to infinite loops
Expand All @@ -28,6 +29,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 +40,12 @@
[javafx.event Event]
[java.text NumberFormat]))

(defn load-font-from-resources
[resource]
(-> resource 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 @@ -369,7 +377,7 @@
:-fx-spacing "1em"}

".big-welcome-subtext"
{:-fx-font-size "1.8em"
{:-fx-font-size "1.6em"
:-fx-font-family "monospace"
:-fx-padding ".8em 0 1em 0"}}

Expand All @@ -388,9 +396,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 +494,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 +509,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 @@ -1694,7 +1703,9 @@
:text "STRONGBOX"}
{:fx/type :label
:style-class ["big-welcome-subtext"]
:text "\"File\" \u2794 \"New addon directory\""}]}
;; note! glyph is using FontAwesome map but the font-family is 'monospace'.
;; it could be java is looking for missing glyphs in other loaded fonts?
:text (str "\"File\" " (:right-arrow constants/glyph-map) " \"New addon directory\"")}]}

(empty? column-list)
{:fx/type :v-box
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

0 comments on commit b660555

Please sign in to comment.