Browse Source

Reverse shared string font family

Michael Ragazzon 6 years ago
parent
commit
1642ddb6af

+ 1 - 1
Include/Rocket/Core/ComputedValues.h

@@ -168,7 +168,7 @@ struct ComputedValues
 	Colourb image_color = Colourb(255, 255, 255);
 	float opacity = 1;
 
-	SharedString font_family;
+	String font_family;
 	String font_charset; // empty is same as "U+0020-007E"
 	FontStyle font_style = FontStyle::Normal;
 	FontWeight font_weight = FontWeight::Normal;

+ 1 - 1
Source/Core/ElementStyle.cpp

@@ -916,7 +916,7 @@ void ElementStyle::ComputeValues(Style::ComputedValues& values, const Style::Com
 			values.opacity = p->Get<float>();
 
 		else if (name == FONT_FAMILY)
-			values.font_family = std::make_shared<String>(ToLower(p->Get<String>()));
+			values.font_family = ToLower(p->Get<String>());
 		else if (name == FONT_CHARSET)
 			values.font_charset = p->Get<String>();
 		else if (name == FONT_STYLE)

+ 1 - 3
Source/Core/ElementUtilities.cpp

@@ -115,15 +115,13 @@ void ElementUtilities::GetElementsByClassName(ElementList& elements, Element* ro
 // Returns the element's font face.
 FontFaceHandle* ElementUtilities::GetFontFaceHandle(const Style::ComputedValues& computed_values)
 {
-	static const String default_family;
 	static const String default_charset = "U+0020-007E";
 
-	const String& family = (computed_values.font_family ? *computed_values.font_family : default_family);
 	const String& charset = (computed_values.font_charset.empty() ? default_charset : computed_values.font_charset);
 	int font_size = (int)computed_values.font_size;
 
 	// TODO Synchronize enums
-	FontFaceHandle* font = FontDatabase::GetFontFaceHandle(family, charset, (Font::Style)computed_values.font_style, (Font::Weight)computed_values.font_weight, font_size);
+	FontFaceHandle* font = FontDatabase::GetFontFaceHandle(computed_values.font_family, charset, (Font::Style)computed_values.font_style, (Font::Weight)computed_values.font_weight, font_size);
 	return font;
 }