@@ -31,4 +31,4 @@ module Squib
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
+6
-1
@@ -24,6 +24,7 @@ module Squib
|
||||
'ellipsis' => "\u2026",
|
||||
'smart_quotes' => true,
|
||||
'text_hint' => 'off',
|
||||
'warn_ellipsize'=> true,
|
||||
}
|
||||
|
||||
#Translate the hints to the methods.
|
||||
@@ -101,6 +102,10 @@ module Squib
|
||||
@config_hash['custom_colors']
|
||||
end
|
||||
|
||||
def warn_ellipsize?
|
||||
@config_hash['warn_ellipsize']
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def normalize_antialias
|
||||
@@ -108,4 +113,4 @@ module Squib
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -109,6 +109,12 @@ module Squib
|
||||
end
|
||||
end
|
||||
|
||||
def warn_if_ellipsized(layout)
|
||||
if @deck.conf.warn_ellipsize? && layout.ellipsized?
|
||||
Squib.logger.warn { "Ellipsized (too much text). Card \##{@index}. Text: \"#{layout.text}\". \n (To disable this warning, set warn_ellipsize: false in config.yml)" }
|
||||
end
|
||||
end
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
def text(embed, para, box, trans, draw)
|
||||
@@ -160,6 +166,7 @@ module Squib
|
||||
draw_text_hint(cc, box.x, box.y, layout, para.hint)
|
||||
extents = { width: layout.extents[1].width / Pango::SCALE,
|
||||
height: layout.extents[1].height / Pango::SCALE }
|
||||
warn_if_ellipsized layout
|
||||
end
|
||||
return extents
|
||||
end
|
||||
|
||||
@@ -37,4 +37,9 @@
|
||||
# ellipsis: "\u2026"
|
||||
|
||||
# We can also disallow smart quotes and only allow explicit replacements with ``LaTeX-style'' quotes.
|
||||
# smart_quotes: false
|
||||
# smart_quotes: false
|
||||
|
||||
# By default, Squib warns when a text box is ellipsized. This can get verbose
|
||||
# and can be turned off here
|
||||
# warn_ellipsize: true # default
|
||||
# warn_ellipsize: false # default
|
||||
|
||||
Reference in New Issue
Block a user