mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Now that there is a unicode symbol for half stars, use it
This commit is contained in:
parent
47f3283ab1
commit
79a7d9885f
@ -1,4 +1,4 @@
|
||||
SplineFontDB: 3.0
|
||||
SplineFontDB: 3.2
|
||||
FontName: calibreSymbols
|
||||
FullName: calibre Symbols
|
||||
FamilyName: calibre Symbols
|
||||
@ -22,7 +22,7 @@ OS2Version: 0
|
||||
OS2_WeightWidthSlopeOnly: 0
|
||||
OS2_UseTypoMetrics: 1
|
||||
CreationTime: 1330331997
|
||||
ModificationTime: 1472969125
|
||||
ModificationTime: 1589697584
|
||||
OS2TypoAscent: 0
|
||||
OS2TypoAOffset: 1
|
||||
OS2TypoDescent: 0
|
||||
@ -41,14 +41,14 @@ DEI: 91125
|
||||
Encoding: UnicodeFull
|
||||
UnicodeInterp: none
|
||||
NameList: Adobe Glyph List
|
||||
DisplaySize: -24
|
||||
DisplaySize: -72
|
||||
AntiAlias: 1
|
||||
FitToEm: 1
|
||||
WidthSeparation: 150
|
||||
WinInfo: 0 152 34
|
||||
WinInfo: 11152 34 12
|
||||
BeginPrivate: 0
|
||||
EndPrivate
|
||||
BeginChars: 1114112 4
|
||||
BeginChars: 1114112 5
|
||||
|
||||
StartChar: uni2605
|
||||
Encoding: 9733 9733 0
|
||||
@ -177,6 +177,36 @@ SplineSet
|
||||
452.702 647.221 458.162 649.834 466.134 649.834 c 4
|
||||
474.454 649.834 466.134 74.71 466.134 74.71 c 1
|
||||
EndSplineSet
|
||||
Validated: 33
|
||||
EndChar
|
||||
|
||||
StartChar: uni2BE8
|
||||
Encoding: 11240 11240 4
|
||||
Width: 979
|
||||
VWidth: -26
|
||||
Flags: W
|
||||
LayerCount: 2
|
||||
Fore
|
||||
SplineSet
|
||||
466.134 74.71 m 1
|
||||
320.554 -51.8184 l 2
|
||||
274.802 -91.5547 249.758 -112.902 245.426 -115.866 c 0
|
||||
241.092 -118.828 236.846 -120.31 232.688 -120.31 c 0
|
||||
227.835 -120.31 223.415 -118.306 219.429 -114.297 c 0
|
||||
215.442 -110.289 213.449 -105.844 213.449 -100.965 c 0
|
||||
213.449 -97.8281 223.329 -71.3379 243.087 -21.4932 c 2
|
||||
322.115 180.323 l 1
|
||||
152.618 289.598 l 2
|
||||
104.783 320.271 79.2217 337.176 75.9297 340.313 c 0
|
||||
72.6357 343.45 70.9893 347.981 70.9893 353.907 c 0
|
||||
70.9893 369.243 79.8291 376.912 97.5059 376.912 c 0
|
||||
98.8926 376.912 123.155 374.82 170.296 370.638 c 2
|
||||
379.825 352.862 l 1
|
||||
427.14 555.201 l 2
|
||||
439.271 607.834 446.811 636.764 449.757 641.992 c 0
|
||||
452.702 647.221 458.162 649.834 466.134 649.834 c 4
|
||||
474.454 649.834 466.134 74.71 466.134 74.71 c 1
|
||||
EndSplineSet
|
||||
Validated: 524321
|
||||
EndChar
|
||||
EndChars
|
||||
|
Binary file not shown.
@ -432,7 +432,7 @@ def check_doi(doi):
|
||||
return None
|
||||
|
||||
|
||||
def rating_to_stars(value, allow_half_stars=False, star='★', half='½'):
|
||||
def rating_to_stars(value, allow_half_stars=False, star='★', half='⯨'):
|
||||
r = max(0, min(int(value or 0), 10))
|
||||
ans = star * (r // 2)
|
||||
if allow_half_stars and r % 2:
|
||||
|
@ -361,7 +361,7 @@ class CreateCustomColumn(QDialog):
|
||||
|
||||
# Rating allow half stars
|
||||
self.allow_half_stars = ahs = QCheckBox(_('Allow half stars'))
|
||||
ahs.setToolTip(_('Allow half star ratings, for example: ') + '<span style="font-family:calibre Symbols">★★★½</span>')
|
||||
ahs.setToolTip(_('Allow half star ratings, for example: ') + '★★★⯨')
|
||||
add_row(None, ahs)
|
||||
|
||||
# Composite display properties
|
||||
|
@ -463,7 +463,7 @@ def test_glyph_ids():
|
||||
|
||||
def test_supports_text():
|
||||
data = P('fonts/calibreSymbols.otf', data=True)
|
||||
if not supports_text(data, '.★½'):
|
||||
if not supports_text(data, '.★½⯨'):
|
||||
raise RuntimeError('Incorrectly returning that text is not supported')
|
||||
if supports_text(data, 'abc'):
|
||||
raise RuntimeError('Incorrectly claiming that text is supported')
|
||||
|
@ -8,7 +8,7 @@ from utils import fmt_sidx, human_readable, rating_to_stars
|
||||
|
||||
@test
|
||||
def misc_utils():
|
||||
assert_equal(rating_to_stars(3, True), '★½')
|
||||
assert_equal(rating_to_stars(3, True), '★⯨')
|
||||
assert_equal(fmt_sidx(10), 'X')
|
||||
assert_equal(fmt_sidx(1.2), '1.20')
|
||||
assert_equal(list(map(human_readable, [1, 1024.0, 1025, 1024*1024*2.3])), ["1 B", "1 KB", "1 KB", "2.3 MB"])
|
||||
|
@ -121,7 +121,7 @@ def fmt_sidx(val, fmt='{:.2f}', use_roman=True):
|
||||
return int(val) + ''
|
||||
return fmt.format(float(val))
|
||||
|
||||
def rating_to_stars(value, allow_half_stars=False, star='★', half='½'):
|
||||
def rating_to_stars(value, allow_half_stars=False, star='★', half='⯨'):
|
||||
r = max(0, min(int(value or 0), 10))
|
||||
if allow_half_stars:
|
||||
ans = star.repeat(r // 2)
|
||||
|
Loading…
x
Reference in New Issue
Block a user