Browse Source

text: Don't try to use harfbuzz if freetype is not enabled either

rdb 1 year ago
parent
commit
347164103c
1 changed files with 4 additions and 4 deletions
  1. 4 4
      panda/src/text/textAssembler.cxx

+ 4 - 4
panda/src/text/textAssembler.cxx

@@ -1479,7 +1479,7 @@ assemble_row(TextAssembler::TextRow &row,
   PN_stdfloat underscore_start = 0.0f;
   PN_stdfloat underscore_start = 0.0f;
   const TextProperties *underscore_properties = nullptr;
   const TextProperties *underscore_properties = nullptr;
 
 
-#ifdef HAVE_HARFBUZZ
+#if defined(HAVE_HARFBUZZ) && defined(HAVE_FREETYPE)
   const ComputedProperties *prev_cprops = nullptr;
   const ComputedProperties *prev_cprops = nullptr;
   hb_buffer_t *harfbuff = nullptr;
   hb_buffer_t *harfbuff = nullptr;
 #endif
 #endif
@@ -1525,7 +1525,7 @@ assemble_row(TextAssembler::TextRow &row,
       line_height = max(line_height, font->get_line_height() * properties->get_glyph_scale() * properties->get_text_scale());
       line_height = max(line_height, font->get_line_height() * properties->get_glyph_scale() * properties->get_text_scale());
     }
     }
 
 
-#ifdef HAVE_HARFBUZZ
+#if defined(HAVE_HARFBUZZ) && defined(HAVE_FREETYPE)
     if (tch._cprops != prev_cprops || graphic != nullptr) {
     if (tch._cprops != prev_cprops || graphic != nullptr) {
       if (harfbuff != nullptr && hb_buffer_get_length(harfbuff) > 0) {
       if (harfbuff != nullptr && hb_buffer_get_length(harfbuff) > 0) {
         // Shape the buffer accumulated so far.
         // Shape the buffer accumulated so far.
@@ -1760,7 +1760,7 @@ assemble_row(TextAssembler::TextRow &row,
     }
     }
   }
   }
 
 
-#ifdef HAVE_HARFBUZZ
+#if defined(HAVE_HARFBUZZ) && defined(HAVE_FREETYPE)
   if (harfbuff != nullptr && hb_buffer_get_length(harfbuff) > 0) {
   if (harfbuff != nullptr && hb_buffer_get_length(harfbuff) > 0) {
     shape_buffer(harfbuff, placed_glyphs, xpos, prev_cprops->_properties);
     shape_buffer(harfbuff, placed_glyphs, xpos, prev_cprops->_properties);
   }
   }
@@ -1797,7 +1797,7 @@ void TextAssembler::
 shape_buffer(hb_buffer_t *buf, PlacedGlyphs &placed_glyphs, PN_stdfloat &xpos,
 shape_buffer(hb_buffer_t *buf, PlacedGlyphs &placed_glyphs, PN_stdfloat &xpos,
              const TextProperties &properties) {
              const TextProperties &properties) {
 
 
-#ifdef HAVE_HARFBUZZ
+#if defined(HAVE_HARFBUZZ) && defined(HAVE_FREETYPE)
   // If we did not specify a text direction, harfbuzz will guess it based on
   // If we did not specify a text direction, harfbuzz will guess it based on
   // the script we are using.
   // the script we are using.
   hb_direction_t direction = HB_DIRECTION_INVALID;
   hb_direction_t direction = HB_DIRECTION_INVALID;