htmlString Transformation does not return expected paragraph spacing #255

Closed
gamma opened this Issue Dec 18, 2012 · 1 comment

Comments

Projects
None yet
2 participants
Contributor

gamma commented Dec 18, 2012

I'm either missing something very badly or the htmlString method lacks of a lot of paragraph styles, e.g. spacing/margins.

This might not be the forum to push diffs, but I'd like to put it here for review. It will add at least margins to paragraphs.

diff --git a/Core/Source/DTCoreTextParagraphStyle.m b/Core/Source/DTCoreTextParagraphStyle.m
index 444463a..634f81f 100644
--- a/Core/Source/DTCoreTextParagraphStyle.m
+++ b/Core/Source/DTCoreTextParagraphStyle.m
@@ -325,7 +325,22 @@ static dispatch_semaphore_t selfLock;
                case kCTWritingDirectionNatural:
                        // no output, this is default
                        break;
-       }       
+       }
+       
+       // Spacing at the bottom
+       if ( _paragraphSpacing!=1.0f ) {
+               [retString appendFormat:@"margin-bottom:%.2fem;", _paragraphSpacing];
+       }
+
+       // Spacing at the top
+       if ( _paragraphSpacingBefore!=1.0f ) {
+               [retString appendFormat:@"margin-top:%.2fem;", _paragraphSpacingBefore];
+       }
+       
+       // Spacing at the left
+       if ( _headIndent!=0.0f ) {
+               [retString appendFormat:@"margin-left:%.2fem;", _paragraphSpacingBefore];
+       }

        // return nil if no content
        if ([retString length])
Collaborator

odrobnik commented Dec 20, 2012

Please submit something like this as pull request!

@odrobnik odrobnik closed this Dec 20, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment