Skip to content

Add DANFE font size configuration - #662

Open
douglasduarte wants to merge 1 commit into
nfephp-org:masterfrom
douglasduarte:codex/danfe-font-sizes
Open

Add DANFE font size configuration#662
douglasduarte wants to merge 1 commit into
nfephp-org:masterfrom
douglasduarte:codex/danfe-font-sizes

Conversation

@douglasduarte

Copy link
Copy Markdown
Contributor

Summary

  • Add DanfeFontSizes to configure DANFE font sizes by block/element.
  • Add Danfe::setFontSizes(...) and replace hardcoded DANFE font sizes with named element lookups.
  • Document usage and add tests for the configuration object and DANFE rendering.

Usage

$danfe = new Danfe($xml);
$danfe->setFontSizes(DanfeFontSizes::fromArray([
    'cabecalho' => [
        'titulo_danfe' => 12,
        'valor' => 9,
    ],
    'itens' => [
        'cabecalho' => 5,
        'dados' => 6,
    ],
]));

Tests

  • php -l src/NFe/DanfeFontSizes.php && php -l src/NFe/Danfe.php && php -l tests/NFe/DanfeFontSizesTest.php && php -l tests/NFe/DanfeTest.php
  • vendor/bin/phpunit --filter "DanfeFontSizesTest|DanfeTest"

Note: running composer test locally on PHP 8.4 currently reports one unrelated failure in NFePHP\DA\Tests\NFSe\DanfseTest::testUsaIbscbsConsolidadoDaInfNfseQuandoInformado: the generated text contains Base de Cálculo Após Exclusões e Reduções R$ 985,00, while the test expects R$ 777,77.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant