Mercurial > projects > dynamin
comparison dynamin/painting/text_layout.d @ 106:acdbb30fee7e
Port to D2.
Most of the effort was dealing with immutable and const.
author | Jordan Miner <jminer7@gmail.com> |
---|---|
date | Mon, 17 Dec 2012 23:41:50 -0600 |
parents | 97997a544ac0 |
children |
comparison
equal
deleted
inserted
replaced
105:97997a544ac0 | 106:acdbb30fee7e |
---|---|
636 private void checkIndex(uint index) { | 636 private void checkIndex(uint index) { |
637 if(index == 0) | 637 if(index == 0) |
638 return; | 638 return; |
639 // NOTE: Do not use cropRight(). It is broken. It will cut off an ending code point even | 639 // NOTE: Do not use cropRight(). It is broken. It will cut off an ending code point even |
640 // when it is a perfectly valid string. Thankfully, cropLeft() works. | 640 // when it is a perfectly valid string. Thankfully, cropLeft() works. |
641 if(cropLeft!(char)(text[index..$]).length != text.length-index) | 641 if(cropLeft!(char)(cast(mstring)text[index..$]).length != text.length-index) |
642 throw new Exception("index must be at a valid code point, not inside one"); | 642 throw new Exception("index must be at a valid code point, not inside one"); |
643 } | 643 } |
644 | 644 |
645 // {{{ layout() | 645 // {{{ layout() |
646 protected void layout(Graphics g) { | 646 protected void layout(Graphics g) { |