Apple News API PHP Client

ComponentTextStyle
in package
implements JsonSerializable

FinalYes

Detailed text styling options for components.

This class controls typography including fonts, colors, spacing, and alignment.

Tags
see
https://developer.apple.com/documentation/applenewsformat/componenttextstyle

Table of Contents

Interfaces

JsonSerializable

Properties

$backgroundColor  : string|null
$dropCapStyle  : array<string|int, mixed>|null
$firstLineIndent  : int|null
$fontName  : string|null
$fontSize  : int|null
$fontStyle  : string|null
$fontWeight  : string|null
$hangingPunctuation  : int|null
$hyphenation  : bool|null
$lineHeight  : float|null
$linkStyle  : array<string|int, mixed>|null
$paragraphSpacingAfter  : int|null
$paragraphSpacingBefore  : int|null
$textAlignment  : string|null
$textColor  : string|null
$textDecoration  : string|null
$textShadow  : array<string|int, mixed>|null
$textTransform  : string|null
$tracking  : float|null

Methods

jsonSerialize()  : array<string, mixed>
setBackgroundColor()  : self
Set background color for the text span.
setDropCapStyle()  : self
Define the drop cap style for the first letter.
setFirstLineIndent()  : self
Set the indentation of the first line.
setFontName()  : self
Set the font family name.
setFontSize()  : self
Set the font size in points.
setFontStyle()  : self
Set font style (normal, italic).
setFontWeight()  : self
Set font weight (e.g., "bold", "100").
setHangingPunctuation()  : self
Control hanging punctuation (e.g., quotes outside the alignment).
setHyphenation()  : self
Enable or disable automatic hyphenation.
setLineHeight()  : self
Set the line height in points.
setLinkStyle()  : self
Define styles for links within the text.
setParagraphSpacingAfter()  : self
Set spacing after paragraphs.
setParagraphSpacingBefore()  : self
Set spacing before paragraphs.
setTextAlignment()  : self
Set text alignment (left, center, right, justify).
setTextColor()  : self
Set the text color.
setTextDecoration()  : self
Set text decoration (underline, line-through).
setTextShadow()  : self
Apply a shadow effect to the text.
setTextTransform()  : self
Set text transform (uppercase, lowercase, capitalize).
setTracking()  : self
Set letter spacing (tracking).

Properties

Methods

jsonSerialize()

public jsonSerialize() : array<string, mixed>
Return values
array<string, mixed>

setBackgroundColor()

Set background color for the text span.

public setBackgroundColor(string $color) : self
Parameters
$color : string
Return values
self

setDropCapStyle()

Define the drop cap style for the first letter.

public setDropCapStyle(array<string, mixed> $style) : self
Parameters
$style : array<string, mixed>
Return values
self

setFirstLineIndent()

Set the indentation of the first line.

public setFirstLineIndent(int $indent) : self
Parameters
$indent : int
Return values
self

setFontName()

Set the font family name.

public setFontName(string $fontName) : self
Parameters
$fontName : string
Return values
self

setFontSize()

Set the font size in points.

public setFontSize(int $fontSize) : self
Parameters
$fontSize : int
Return values
self

setFontStyle()

Set font style (normal, italic).

public setFontStyle(string $style) : self
Parameters
$style : string
Return values
self

setFontWeight()

Set font weight (e.g., "bold", "100").

public setFontWeight(string $weight) : self
Parameters
$weight : string
Return values
self

setHangingPunctuation()

Control hanging punctuation (e.g., quotes outside the alignment).

public setHangingPunctuation(int $value) : self
Parameters
$value : int
Return values
self

setHyphenation()

Enable or disable automatic hyphenation.

public setHyphenation(bool $hyphenation) : self
Parameters
$hyphenation : bool
Return values
self

setLineHeight()

Set the line height in points.

public setLineHeight(float $lineHeight) : self
Parameters
$lineHeight : float
Return values
self

setLinkStyle()

Define styles for links within the text.

public setLinkStyle(array<string, mixed> $style) : self
Parameters
$style : array<string, mixed>
Return values
self

setParagraphSpacingAfter()

Set spacing after paragraphs.

public setParagraphSpacingAfter(int $spacing) : self
Parameters
$spacing : int
Return values
self

setParagraphSpacingBefore()

Set spacing before paragraphs.

public setParagraphSpacingBefore(int $spacing) : self
Parameters
$spacing : int
Return values
self

setTextAlignment()

Set text alignment (left, center, right, justify).

public setTextAlignment(string $alignment) : self
Parameters
$alignment : string
Return values
self

setTextColor()

Set the text color.

public setTextColor(string $color) : self
Parameters
$color : string
Return values
self

setTextDecoration()

Set text decoration (underline, line-through).

public setTextDecoration(string $decoration) : self
Parameters
$decoration : string
Return values
self

setTextShadow()

Apply a shadow effect to the text.

public setTextShadow(array<string, mixed> $shadow) : self
Parameters
$shadow : array<string, mixed>
Return values
self

setTextTransform()

Set text transform (uppercase, lowercase, capitalize).

public setTextTransform(string $transform) : self
Parameters
$transform : string
Return values
self

setTracking()

Set letter spacing (tracking).

public setTracking(float $tracking) : self
Parameters
$tracking : float
Return values
self

        
On this page

Search results