summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/fpdfedit_embeddertest.cpp4
-rw-r--r--fpdfsdk/fpdfedittext.cpp5
2 files changed, 9 insertions, 0 deletions
diff --git a/fpdfsdk/fpdfedit_embeddertest.cpp b/fpdfsdk/fpdfedit_embeddertest.cpp
index 9f43054b4c..1fb0cde7f9 100644
--- a/fpdfsdk/fpdfedit_embeddertest.cpp
+++ b/fpdfsdk/fpdfedit_embeddertest.cpp
@@ -82,6 +82,10 @@ class FPDFEditEmbeddertest : public EmbedderTest {
// Check that the font stream is the one that was provided
CPDF_Stream* font_stream = font_desc->GetStreamFor(present);
ASSERT_EQ(size, font_stream->GetRawSize());
+ if (font_type == FPDF_FONT_TRUETYPE) {
+ ASSERT_EQ(static_cast<int>(size),
+ font_stream->GetDict()->GetIntegerFor("Length1"));
+ }
uint8_t* stream_data = font_stream->GetRawData();
for (size_t j = 0; j < size; j++)
EXPECT_EQ(data[j], stream_data[j]) << " at byte " << j;
diff --git a/fpdfsdk/fpdfedittext.cpp b/fpdfsdk/fpdfedittext.cpp
index bac1108243..22c6266ec1 100644
--- a/fpdfsdk/fpdfedittext.cpp
+++ b/fpdfsdk/fpdfedittext.cpp
@@ -71,6 +71,11 @@ CPDF_Dictionary* LoadFontDesc(CPDF_Document* pDoc,
CPDF_Stream* pStream = pDoc->NewIndirect<CPDF_Stream>();
pStream->SetData(data, size);
+ // TODO(npm): Lengths for Type1 fonts.
+ if (font_type == FPDF_FONT_TRUETYPE) {
+ pStream->GetDict()->SetNewFor<CPDF_Number>("Length1",
+ static_cast<int>(size));
+ }
ByteString fontFile = font_type == FPDF_FONT_TYPE1 ? "FontFile" : "FontFile2";
fontDesc->SetNewFor<CPDF_Reference>(fontFile, pDoc, pStream->GetObjNum());
return fontDesc;