Skip to content

Conversation

JoseALermaIII
Copy link
Owner

Summary

Finish off Chapter 6 with a monospace invisible ink writer challenge project.

Description

Uses a monospace font to embed a hidden message in the whitespace between letters. The biggest challenge was writing color tests for the spaces between words in tests/test_chapter06.py.

It uses a similar logic to putting the cipher letters between words. That may be considered more of an integration test, but I opted to not put them in a separate file since there are so few of them.

Selecting a monospace font is another challenge. Unfortunately, different operating systems use different fonts. To mitigate this issue, the code uses platform.system to query the platform and attempt to select an appropriate font.

Creating a blank default template in LibreOffice is another challenge. To change a style, it often has to be applied to a paragraph. In this case, LibreOffice applies the modified style to a blank paragraph. Normally, this wouldn't matter, but Microsoft Word doesn't need to apply a modified style to a paragraph in order to save it.

I wanted to create a function to do the font color tests, but this inconsistency prevents me from doing so because it always loads a blank as the first text object, but only from the monospace template file. I could just create a template in Word, but, to me, that defeats the purpose of using open software. For now, the font color tests are separate for the two different font types.

For many reasons, this code shouldn't be used for covert operations, but one of the main ones is that it creates giant run-on sentences that the spell checker is all too quick to point out. Nevertheless, it was a fun project to work on. For example, src/ch06/c1files/fake.docx is an open letter of sorts to the Internet briefly discussing its origins, reminiscing about its past, and speculating about its future. Part fun, part making enough test spaces.

Normally, I'd reference #1 as a running gag about making PRs, but I've accepted these as a pseudo-blog and will, regrettably, stop referencing #1 after this PR. May the meme live on in our hearts.

Team Notifications

Me, myself, and I

@JoseALermaIII JoseALermaIII self-assigned this Oct 2, 2019
@JoseALermaIII JoseALermaIII added the enhancement New feature or request label Oct 2, 2019
@JoseALermaIII
Copy link
Owner Author

RIP coverage, including line 108, now there are a total of two uncovered lines in the entire project.

if system().lower().startswith('windows'):
font.name = 'Courier New'

At least every experience can be a learning experience.

@JoseALermaIII JoseALermaIII merged commit b96ef15 into master Oct 2, 2019
@JoseALermaIII JoseALermaIII deleted the invisible-ink-mono branch October 2, 2019 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant