Feat/font autoscale (#288)
* PoC font autosize feature * Take enumerables or 'auto' keyword for autoscaling * Allo enumerables of font_size per card, where the largest font size that does not ellipsize is chosen * Use ellipsize: :autoscale keyword to determine font autosizing * Use binary search to find the correct font size * Consider new ellipsize option in testcase * Document ellipsize: :autoscale option * Add ellipsize: :autoscale sample to text sample * Fix double multiplication with Pango::SCALE * Scale embedded images with text when autoscaling * Remove stray semicolon * Return dummy value for FontDescription.size in mock_cairo * Update regression test data for autoscale feature. * Add ellipsize: :autoscale example to existing font_autoscale sample * Add missing :autoscale to list of options in documentation
This commit is contained in:
@@ -97,9 +97,14 @@ describe Squib::Args::Paragraph do
|
||||
para.load!({ ellipsize: 'END' })
|
||||
expect(para.ellipsize).to eq [Pango::EllipsizeMode::END]
|
||||
end
|
||||
|
||||
it 'converts to autoscale' do
|
||||
para.load!({ ellipsize: :autoscale})
|
||||
expect(para.ellipsize).to eq [:autoscale]
|
||||
end
|
||||
|
||||
it 'raises an exception on anything else' do
|
||||
expect { para.load!({ ellipsize: 'foo' }) }.to raise_error(ArgumentError, 'ellipsize must be one of: none, start, middle, end, true, or false')
|
||||
expect { para.load!({ ellipsize: 'foo' }) }.to raise_error(ArgumentError, 'ellipsize must be one of: none, start, middle, end, true, false or autoscale')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user